annotate python/example/subclass.py @ 767:35f8751c0930
it is very annoying to have ones overrides overridden; see also http://stackoverflow.com/questions/25381304/why-type-cd-on-mac-os-states-that-cd-is-a-function
author |
Jeff Hammel <k0scist@gmail.com> |
date |
Thu, 28 Jan 2016 14:02:17 -0800 |
parents |
ae7e75a8cdb0 |
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)
|