<div dir="ltr">> If an object has no slots or dict and does not accept attribute assignment, is it not effectively immutable?<div><br></div><div>No, not necessarily.</div><div><br></div><div>class A(list): __slots__ = ()</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-07-28 10:00 GMT+02:00 Mike Miller <span dir="ltr"><<a href="mailto:python-ideas@mgmiller.net" target="_blank">python-ideas@mgmiller.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 2017-07-27 18:02, Chris Angelico wrote:<br>
> As Ivan said, this is to do with __slots__. It's nothing to do with<br>
> immutability:<br>
<br></span>
>>> object().__slots__<span class=""><br>
Traceback (most recent call last):<br>
  File "<stdin>", line 1, in <module><br></span>
AttributeError: 'object' object has no attribute '__slots__'<br>
<br>
>>> object().__dict__<span class=""><br>
Traceback (most recent call last):<br>
  File "<stdin>", line 1, in <module><br></span>
AttributeError: 'object' object has no attribute '__dict__'<br>
>>><br>
<br>
If an object has no slots or dict and does not accept attribute assignment, is it not effectively immutable?<span class="HOEnZb"><font color="#888888"><br>
<br>
-Mike</font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Antoine Rozo</div></div>
</div>