Mercurial > hg > config
view python/example/subclass.py @ 751:753b1c2bd64c
match is NOT POSIX
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Tue, 30 Jun 2015 15:35:34 -0700 (2015-06-30) |
| parents | ae7e75a8cdb0 |
| children |
line wrap: on
line source
import string from pprint import pprint class Foo: pass class Bar(Foo): pass fleem = 1 mystuff = {i:j for i, j in globals().items()} types = {i:type(j) for i, j in globals().items()} mynewstuff = {i:j for i, j in mystuff.items() if (type(j) == type(Foo)) and issubclass(j, Foo)} pprint(mynewstuff)
