Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
>>> class Foo(object):
... pass
...
>>> def bar():
... class Bar(Foo):
... pass
...
>>> Foo.__subclasses__()
[]
>>> bar()
>>> Foo.__subclasses__()
[<class '__main__.Bar'>]
>>> bar()
>>> Foo.__subclasses__()
[<class '__main__.Bar'>, <class '__main__.Bar'>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment