annotate python/subclass.py @ 624:b0144a39086d

rm old email
author Jeff Hammel <k0scist@gmail.com>
date Wed, 12 Feb 2014 14:27: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)