Pickling dynamically generated classes?
问题 I'm using type() to dynamically generate classes that will ultimately be pickled. The problem is that the un-pickling process needs the definition of the class in order to re-construct the object that has been pickled. This is where I'm stuck. I don't know how to somehow provide the unpickler a way to generate an instance from a class that was dynamically generated. Any hints appreciated. Thanks! Here's an example of the problem: >>> class Foo(object): ... pass >>> g=type('Goo',(Foo,),{'run'