Re: Iterate through slots

2008-01-20 Thread Gabriel Genellina
En Tue, 15 Jan 2008 16:35:52 -0200, Jared Grubb <[EMAIL PROTECTED]> escribi�: > How can I iterate through the slots of a class, including those it > inherits > from parent classes? > > class C(object): > __slots__ = ['a'] > > class D(C): > __slots__ = ['b'] > Iterate over all the class hi

Iterate through slots

2008-01-15 Thread Jared Grubb
How can I iterate through the slots of a class, including those it inherits from parent classes? class C(object): __slots__ = ['a'] class D(C): __slots__ = ['b'] >>> d = D() >>> d.__slots__ ['b'] >>> d.a = 1 # this works, so slots inherit properly >>> d.b = 2 >>> d.c = 3 # this doesnt work,