annotate python/subclass.py @ 677:f3c73873bcb5

script to really forecably remove debian packages
author Jeff Hammel <k0scist@gmail.com>
date Sat, 10 May 2014 10:38:56 -0700
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)