Mercurial > hg > config
view python/subclass.py @ 650:9cb40c01c10a
illustrate downloading a package and rerunning via exec
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 24 Mar 2014 13:54:24 -0700 |
parents | e21c49e32b95 |
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)