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
type()
Well, for the posterity; works with cloudpickle
import cloudpickle class Foo(object): pass g=type('Goo',(Foo,),{'run':lambda self,x: 2*x } )() cloudpickle.dumps(g)