-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Il 04/10/2012 13:22, Daniele Varrazzo ha scritto: > [...] > In [12]: import gc > > In [14]: id(c) > Out[14]: 43878544 > > In [15]: for o in gc.get_objects(): > ....: if isinstance(o, oldcls): > ....: print id(o) > ....: o.__class__ = newcls > ....: > ....:
Ha il problema che non gestisce i casi in cui modifichi gli slots di una classe. Un esempio preso dallo standard di Common Lisp: http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html > [...] Ciao Manlio -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlBtjUAACgkQscQJ24LbaUTYjACfQJcO49F/4sn73jGX9/MjlFXn QJAAniSbEH0wnaCWbzIzt6Uiws2btYHS =64Rh -----END PGP SIGNATURE----- _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python