annotate python/example/subclass.py @ 722:be9f792abaad

mv
author Jeff Hammel <k0scist@gmail.com>
date Tue, 04 Nov 2014 15:11:08 -0800
parents ae7e75a8cdb0
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)