Skip to content

Instantly share code, notes, and snippets.

@sb2nov
Created June 6, 2017 00:06
Show Gist options
  • Save sb2nov/52b5091fcc7135bcd02948088d876d5b to your computer and use it in GitHub Desktop.
Save sb2nov/52b5091fcc7135bcd02948088d876d5b to your computer and use it in GitHub Desktop.
Test python import
class A(object):
def __init__():
print 'A'
from a import A
class B(A):
def __init__():
print 'B'
from a import A
class C(A):
def __init__():
print 'C'
from a import A
print A.__subclasses__()
# []
from b import B
print A.__subclasses__()
# [<class 'b.B'>]
from c import C
print A.__subclasses__()
# [<class 'b.B'>, <class 'c.C'>]
@sb2nov
Copy link
Author

sb2nov commented Jun 6, 2017

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment