Mercurial > hg > config
changeset 680:ae7e75a8cdb0
mv
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 13 May 2014 12:58:48 -0700 |
parents | da62e6411ab7 |
children | bc1f4762027b |
files | python/example/subclass.py python/subclass.py |
diffstat | 2 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/example/subclass.py Tue May 13 12:58:48 2014 -0700 @@ -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)
--- a/python/subclass.py Tue May 13 12:57:57 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -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)