On 11/1/05, Josiah Carlson <[EMAIL PROTECTED]> wrote: ... > > I still consider it dead. > "If the implementation is hard to explain, it's a bad idea."
It is sometimes true, but not always. It may mean two other things: 1. The one trying to explain is not talented enough. 2. The implementation is really not very simple. A hash table, used so widely in Python, is really not a simple idea, and it's not that easy to explain. > > 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' > >>> It doesn't matter. It only means that the implementation would have to make frozen copies also of __slots__ items, when freezing a user-defined class. I am afraid that this question proves that I didn't convey my idea to you. If you like, please forgive my inability to explain it clearly, and try again to understand my idea, by going over what I wrote again, and thinking on it. You can also wait for the PEP that I intend to write. And you can also forget about it, if you don't want to bother with it - you've already helped a lot. Noam _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com