changeset 598:e21c49e32b95

new
author Jeff Hammel <k0scist@gmail.com>
date Wed, 29 Jan 2014 13:30:13 -0800
parents 04dfe64d1ba7
children 782dc37492c4
files python/subclass.py
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/subclass.py	Wed Jan 29 13:30:13 2014 -0800
@@ -0,0 +1,18 @@
+import string
+from pprint import pprint
+
+class Foo:
+    pass
+
+class Bar(Foo):
+    pass
+
+fleem = 1
+
+mystuff = {i:j for i, j in globals().items()}
+types = {i:type(j) for i, j in globals().items()}
+
+mynewstuff = {i:j for i, j in mystuff.items()
+              if (type(j) == type(Foo)) and issubclass(j, Foo)}
+
+pprint(mynewstuff)