Last active
December 19, 2015 02:59
-
-
Save berinhard/5887347 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Class1(): | |
pass | |
class Class2(): | |
pass | |
class Class3(object): | |
pass | |
a = Class1() | |
b = Class1() | |
assert True == isinstance(a, type(b)) | |
assert True == isinstance(b, type(a)) | |
c = Class2() | |
assert True == isinstance(c, type(a)) | |
d = Class3() | |
assert False == isinstance(d, type(a)) | |
assert False == isinstance(d, type(c)) | |
assert False == isinstance(a, type(d)) | |
assert False == isinstance(c, type(d)) | |
print "tipo de a " + str(type(a)) | |
print "tipo de d " + str(type(d)) | |
#more info here: http://stackoverflow.com/questions/54867/old-style-and-new-style-classes-in-python | |
#and here: http://stackoverflow.com/questions/332255/difference-between-class-foo-and-class-fooobject-in-python |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment