annotate python/subclass.py @ 618:5ab1df94cc8d

read TODOs from directory tree (unfinished)
author Jeff Hammel <k0scist@gmail.com>
date Mon, 03 Feb 2014 13:29:12 -0800
parents e21c49e32b95
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
598
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 import string
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 from pprint import pprint
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 class Foo:
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 pass
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 class Bar(Foo):
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 pass
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 fleem = 1
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 mystuff = {i:j for i, j in globals().items()}
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 types = {i:type(j) for i, j in globals().items()}
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 mynewstuff = {i:j for i, j in mystuff.items()
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 if (type(j) == type(Foo)) and issubclass(j, Foo)}
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 pprint(mynewstuff)