John Machin wrote in
news:[EMAIL PROTECTED] in
comp.lang.python:
> Rob Williscroft wrote:
>> John Machin wrote in news:1167008799.074885.250770@
>> 73g2000cwn.googlegroups.com in comp.lang.python:
>>
>> > Given a = Adder(),
>> > a.tally = 0
>> > gets AttributeError: 'Adder' object attribute '
Rob Williscroft wrote:
> John Machin wrote in news:1167008799.074885.250770@
> 73g2000cwn.googlegroups.com in comp.lang.python:
>
> > Given a = Adder(),
> > a.tally = 0
> > gets AttributeError: 'Adder' object attribute 'tally' is read-only
> > a.notinslots = 1
> > gets AttributeError: 'Adde
John Machin wrote in news:1167008799.074885.250770@
73g2000cwn.googlegroups.com in comp.lang.python:
> Given a = Adder(),
> a.tally = 0
> gets AttributeError: 'Adder' object attribute 'tally' is read-only
> a.notinslots = 1
> gets AttributeError: 'Adder' object attribute 'notinslots' is re
AttributeError: 'Adder' object attribute 'notinslots' is read-only
So is there some magic class-fu going down here, or is this just a
waste of memory space in the instances?
=== example ===
# class with method names in __slots__
class Adder(object):
__slots__ = [