[issue12766] strange interaction between __slots__ and class-level attributes
Antoine Pitrou
report at bugs.python.org
Wed Aug 17 01:20:01 CEST 2011
Antoine Pitrou <pitrou at free.fr> added the comment:
> So would you prefer to see
>
> >>> x.foo
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: foo
> >>> x.foo = 5
> >>> x.foo
> 5
> ?
No, I would prefer to see
True
>>> x.foo = 5
>>> x.foo
5
... exactly as in the same class without a __slots__
(the whole point of class attributes being to set default values without
complicating the constructor)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12766>
_______________________________________
More information about the Python-bugs-list
mailing list