Skip to content

Instantly share code, notes, and snippets.

@malkarouri
Created August 14, 2010 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malkarouri/524744 to your computer and use it in GitHub Desktop.
Save malkarouri/524744 to your computer and use it in GitHub Desktop.
>>> 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