That's a subclass.  Also:

>>> class A(list): __slots__ = ()
...
>>>
>>> a = A()
>>> a.foo = 'bar'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'A' object has no attribute 'foo'

-Mike


On 2017-07-28 01:06, Antoine Rozo wrote:
> 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__ = ()

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to