Re: pickling instances of metaclass generated classes

2012-01-03 Thread Ian Kelly
> Ok, > > After reading all posts (thanks a lot), I am considering to use the > following base metaclass for all metaclasses that must lead to > pickleable instances (not pickleable classes): > > > import sys > > class Meta(type): >def __new__(mcls, name, bases, attrs): >cls = type.__ne

Re: pickling instances of metaclass generated classes

2012-01-03 Thread lars van gemerden
On Dec 29 2011, 10:55 am, lars van gemerden wrote: > Hello, > > Can someone help me with the following: > > I am using metaclasses to make classes and these classes to make > instances. Now I want to use multiprocessing, which needs to pickle > these instances. > > Pickle cannot find the class def

Re: pickling instances of metaclass generated classes

2012-01-01 Thread Peter Otten
lars van gemerden wrote: >> import pickle >> import sys >> >> class MetaClass(type): >> pass >> >> class M(object): >> def __init__(self, module): >> self.__module = module >> def __getattr__(self, name): >> print "creating class", name >> class_ = MetaC

Re: pickling instances of metaclass generated classes

2011-12-30 Thread Ian Kelly
On Fri, Dec 30, 2011 at 9:51 AM, lars van gemerden wrote: > I still wonder whether it might be easier to add the class to the > namespace. Can anyone help me with that? from mypackage import mymodule setattr(mymodule, myclass.__name__, myclass) -- http://mail.python.org/mailman/listinfo/python-

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 30, 4:56 pm, lars van gemerden wrote: > On Dec 30, 12:16 pm, lars van gemerden wrote: > > > > > > > > > > > On Dec 29, 8:55 pm, Ian Kelly wrote: > > > > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > > > wrote: > > > > > Hello, > > > > > Can someone help me with the following: > >

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 30, 12:16 pm, lars van gemerden wrote: > On Dec 29, 8:55 pm, Ian Kelly wrote: > > > > > > > > > > > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > > wrote: > > > > Hello, > > > > Can someone help me with the following: > > > > I am using metaclasses to make classes and these classe

Re: pickling instances of metaclass generated classes

2011-12-30 Thread Peter Otten
lars van gemerden wrote: > On Dec 29, 8:55 pm, Ian Kelly wrote: >> On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden >> wrote: >> >> > Hello, >> >> > Can someone help me with the following: >> >> > I am using metaclasses to make classes and these classes to make >> > instances. Now I want to us

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 29, 8:55 pm, Ian Kelly wrote: > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > wrote: > > > Hello, > > > Can someone help me with the following: > > > I am using metaclasses to make classes and these classes to make > > instances. Now I want to use multiprocessing, which needs to pi

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 29, 8:55 pm, Ian Kelly wrote: > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > wrote: > > > Hello, > > > Can someone help me with the following: > > > I am using metaclasses to make classes and these classes to make > > instances. Now I want to use multiprocessing, which needs to pi

Re: pickling instances of metaclass generated classes

2011-12-29 Thread Ian Kelly
On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden wrote: > Hello, > > Can someone help me with the following: > > I am using metaclasses to make classes and these classes to make > instances. Now I want to use multiprocessing, which needs to pickle > these instances. > > Pickle cannot find the cl

Re: pickling instances of metaclass generated classes

2011-12-29 Thread Robert Kern
On 12/29/11 9:55 AM, lars van gemerden wrote: Hello, Can someone help me with the following: I am using metaclasses to make classes and these classes to make instances. Now I want to use multiprocessing, which needs to pickle these instances. Pickle cannot find the class definitions of the ins

pickling instances of metaclass generated classes

2011-12-29 Thread lars van gemerden
Hello, Can someone help me with the following: I am using metaclasses to make classes and these classes to make instances. Now I want to use multiprocessing, which needs to pickle these instances. Pickle cannot find the class definitions of the instances. I am trying to add a line to the __new__