Re: [Python-Dev] Pickling instances of nested classes

2005-04-01 Thread Walter Dörwald
Samuele Pedroni wrote: [...] this should approximate that behavior better: [not tested] import sys def __new__(cls, name, bases, dic): sub = [x for x in dic.values() if isinstance(x,HierarchMeta)] newtype = type.__new__(cls, name, bases, dic) for x in sub: if not ha

Re: [Python-Dev] Pickling instances of nested classes

2005-04-01 Thread Samuele Pedroni
Walter Dörwald wrote: Samuele Pedroni wrote: [...] And having the full name of the class available would certainly help in debugging. that's probably the only plus point but the names would be confusing wrt modules vs. classes. You'd propably need a different separator in repr. XIST does this:

Re: [Python-Dev] Pickling instances of nested classes

2005-04-01 Thread Walter Dörwald
Samuele Pedroni wrote: [...] And having the full name of the class available would certainly help in debugging. that's probably the only plus point but the names would be confusing wrt modules vs. classes. You'd propably need a different separator in repr. XIST does this: >>> from ll.xist.ns impo

Re: [Python-Dev] Pickling instances of nested classes

2005-03-31 Thread Samuele Pedroni
Walter Dörwald wrote: Samuele Pedroni wrote: Walter Dörwald wrote: [User cases for pickling instances of nested classes] So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? notice that in this cases often metaclasses are involved or could easely be, so i

Re: [Python-Dev] Pickling instances of nested classes

2005-03-31 Thread Walter Dörwald
Samuele Pedroni wrote: Walter Dörwald wrote: [User cases for pickling instances of nested classes] So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? notice that in this cases often metaclasses are involved or could easely be, so if pickling would honor

Re: [Python-Dev] Pickling instances of nested classes

2005-03-31 Thread Walter Dörwald
Martin v. Löwis wrote: Walter Dörwald wrote: So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? I think it is just not worth it. This means I won't attempt to implement it. I think I defined originally the __module__ attribute for classes to support bette

Re: [Python-Dev] Pickling instances of nested classes

2005-03-29 Thread Samuele Pedroni
Walter Dörwald wrote: For XML: 1) Those classes are the element types and the nested classes are the attributes. 2) Being able to define those attributes as separate classes makes it possible to implement custom functionality (e.g. for validation or for handling certain attribute types like URLs, c

Re: [Python-Dev] Pickling instances of nested classes

2005-03-29 Thread Martin v. Löwis
Walter Dörwald wrote: So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? I think it is just not worth it. This means I won't attempt to implement it. I think I defined originally the __module__ attribute for classes to support better pickling (and defined