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', )
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
Russell E. Owen wrote:
> It seems that the path was to a "fat" file partition and included a
> directory name that was all uppercase. The directory was created, but
> using lowercase. I'm not yet sure the version of python.
>
> The workaround for now is to not use fat file partitions. But I was
John Salerno wrote:
> I'm having some slight trouble understanding exactly why this creates an
> infinite loop:
>
> L = [1, 2]
> L.append(L)
I tried this with Python 2.3.5 and it handles this tailbiter in a
very pleasantly surprising way:
>>> l = [ 0, 1 ]
>>> l.append( l )
>>> l
[0, 1, [...]]
>>