problem pickling objects created with the type function
Greg Chapman
glc at well.com
Fri Apr 23 07:34:26 EDT 2004
More information about the Python-list mailing list
Fri Apr 23 07:34:26 EDT 2004
- Previous message (by thread): utf in Reportlab
- Next message (by thread): problem pickling objects created with the type function
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 21 Apr 2004 14:57:17 -0700, danny_shevitz at yahoo.com (danny) wrote: >I'm pretty sure the failure is because 'foobar' is never in the global >namespace. If I change the code to foobar = type('foobar',... then >the code works, but I dont' want to do this because I create the class >name in a factory and it is mangled to prevent different invocations >of the factory from having the same class name. > >Does anyone know how to get around this, or how to get 'foobar' = >childType into the global namespace? You should be able to make foobars pickleable without introducing foobar into the global namespace by using a __reduce__ method, see: http://www.python.org/peps/pep-0307.html expecially the section "Extended __reduce__ API". --- Greg Chapman
- Previous message (by thread): utf in Reportlab
- Next message (by thread): problem pickling objects created with the type function
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list