Mercurial > hg > config
annotate python/subclass.py @ 631:d87a17e1abac
-> http://k0s.org/hg/TextShaper/rev/e6f680d25d63
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 23 Feb 2014 00:49:18 -0800 |
parents | e21c49e32b95 |
children |
rev | line source |
---|---|
598 | 1 import string |
2 from pprint import pprint | |
3 | |
4 class Foo: | |
5 pass | |
6 | |
7 class Bar(Foo): | |
8 pass | |
9 | |
10 fleem = 1 | |
11 | |
12 mystuff = {i:j for i, j in globals().items()} | |
13 types = {i:type(j) for i, j in globals().items()} | |
14 | |
15 mynewstuff = {i:j for i, j in mystuff.items() | |
16 if (type(j) == type(Foo)) and issubclass(j, Foo)} | |
17 | |
18 pprint(mynewstuff) |