I think this should help
https://stackoverflow.com/questions/1779372/python-metaclasses-vs-class-decorators
On Sat, 4 Apr, 2020, 6:12 pm Antoon Pardon,
wrote:
> Op 29/03/20 om 16:49 schreef Peter Otten:
> > Antoon Pardon wrote:
> >
> >>
> >> I have the following program
> >>
> >> class slt:
> >>
Op 29/03/20 om 16:49 schreef Peter Otten:
> Antoon Pardon wrote:
>
>>
>> I have the following program
>>
>> class slt:
>> __slots__ = ()
>>
...
>>
>> class slt1 (slt):
>> __slots__ = 'fld1', 'fld2'
>>
...
>>
>> class slt2(slt1):
>> __slots__ = 'fld3',
>>
> Anyway, here's my attempt to
Antoon Pardon wrote:
>
> I have the following program
>
> class slt:
> __slots__ = ()
>
> def getslots(self):
> print("### slots =", self.__slots__)
> if self.__slots__ == ():
> return []
> else:
> ls = super().getslots()
> ls.extend(self.__slots__)
> return ls
>
> def __str__(self):
> ls = []
I have the following program
class slt:
__slots__ = ()
def getslots(self):
print("### slots =", self.__slots__)
if self.__slots__ == ():
return []
else:
ls = super().getslots()