Skip to content

Instantly share code, notes, and snippets.

@robertwb
Forked from sb2nov/a.py
Last active June 6, 2017 17:02
Show Gist options
  • Save robertwb/c171444f53a2dd55787a38186d4b1e45 to your computer and use it in GitHub Desktop.
Save robertwb/c171444f53a2dd55787a38186d4b1e45 to your computer and use it in GitHub Desktop.
Test python import
print "defining A"
class A(object):
def __init__():
print 'A'
from a import A
print "defining B"
class B(A):
def __init__():
print 'B'
import c
from a import A
print "defining C"
class C(A):
def __init__():
print 'C'
from a import A
print A.__subclasses__()
# []
import b
# defining B
# defining C
print A.__subclasses__()
# [<class 'b.B'>, <class 'c.C'>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment