
If an object has no slots or dict and does not accept attribute assignment, is it not effectively immutable?
No, not necessarily. class A(list): __slots__ = () 2017-07-28 10:00 GMT+02:00 Mike Miller <python-ideas@mgmiller.net>:
On 2017-07-27 18:02, Chris Angelico wrote:
As Ivan said, this is to do with __slots__. It's nothing to do with immutability:
object().__slots__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'object' object has no attribute '__slots__'
object().__dict__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'object' object has no attribute '__dict__'
If an object has no slots or dict and does not accept attribute assignment, is it not effectively immutable?
-Mike
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- Antoine Rozo