Writing this code:
>>> class T:
>>> version = '1.0'
>>> import pickle
>>> pickled = pickle.dumps(T)
>>> T.version = '2.0'
>>> PT = pickle.loads(pickled)
>>> PT.version
>>> '2.0'
Why does that happen? Should not be PT.version == '1.0' as it was when pickled? On the other hand, I'm seeing that
>>> T
<class '__main__.T'>
>>> PT
<class '__main__.T'>
>>> id(PT) == id(T)
True
Are python class objects (not class instances, the class object itself) singletons or something like that? I would expect that there would be two different classes now but there seems to be just one, and two different aliases or references or names.