Created
August 14, 2010 21:36
-
-
Save malkarouri/524744 to your computer and use it in GitHub Desktop.
This file contains 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 Mcl(type): pass | |
>>> class A: __metaclass__ = Mcl | |
>>> class B: | |
class __metaclass__(type): pass | |
>>> class C: | |
class __metaclass__(type): pass | |
>>> a, b, c = A(), B(), C() | |
>>> def roundtrip(obj): | |
from pickle import dumps, loads | |
s = dumps(obj) | |
return loads(s) | |
>>> roundtrip(a) | |
<__main__.A object at 0x011C38F0> | |
>>> roundtrip(b) | |
<__main__.B object at 0x011AA4B0> | |
>>> roundtrip(c) | |
<__main__.C object at 0x011AAD50> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment