This seems like another question , but in this case I would like to understand that type comparison between two types of classes is the same, but dynamically created.
Let's look at an example of this question overflowing https://stackoverflow.com/a/312960/212 :
class SecretBaseClass(object):
pass
class Class(object):
pass
ClassType1 = type(Class.__name__, (SecretBaseClass,), dict(Class.__dict__))
ClassType2 = type(Class.__name__, (SecretBaseClass,), dict(Class.__dict__))
If I then do:
print ClassType1 == ClassType2
my result is false.
I understand that I created two different types, but for a person they are the same. At what level does the comparison operator recognize the difference?
source
share