Steven Bethard wrote:
> But why do you want a class level attribute with the same name as an
> instance level attribute? I would have written your class as:
>
> class A(object):
> __slots__ = ['value']
> def __init__(self, value=1):
> self.value = value
>
> where the default va
Ewald R. de Wit wrote:
> I'm running into a something unexpected for a new-style class
> that has both a class attribute and __slots__ defined. If the
> name of the class attribute also exists in __slots__, Python
> throws an AttributeError. Is this by design (if so, why)?
>
> class A( object ):
I'm running into a something unexpected for a new-style class
that has both a class attribute and __slots__ defined. If the
name of the class attribute also exists in __slots__, Python
throws an AttributeError. Is this by design (if so, why)?
class A( object ):
__slots__ = ( 'value', )