[Python-Dev] apparent ruminations on mutable immutables (was: PEP 351, the freeze protocol)

Josiah Carlson jcarlson at uci.edu
Tue Nov 1 22:03:56 CET 2005

> That's fine. I wish that you read my answer, think about it a little,
> and just tell me in a yes or a no if you still consider it dead. I
> think that I have answered all your questions, and I hope that at
> least others would be convinced by them, and that at the end my
> suggestion would be accepted.

I still consider it dead.
    "If the implementation is hard to explain, it's a bad idea."

Also, not all user-defined classes have a __dict__, and not all
user-defined classes can have arbitrary attributes added to them.

c>>> class foo(object):
...     __slots__ = ['lst']
...     def __init__(self):
...         self.lst = []
>>> a = foo()
>>> a.bar = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'foo' object has no attribute 'bar'

 - Josiah

More information about the Python-Dev mailing list