[Python-ideas] namedtuple nit...

Mike Miller python-ideas at mgmiller.net
Fri Jul 28 14:23:49 EDT 2017


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__ = ()
> 


More information about the Python-ideas mailing list