On 12 Gen, 14:45, Paul Rubin <http://[email protected]> wrote:
> [email protected] writes:
> > > class Foo (DynamicAttributes, object): pass
>
> > You cannot do that, but you can establish a fixed set of attributes by
> > defining the __slot__ class variable.
>
> That is not what __slot__ is for.
Really? It seems to work:
>>> class A(object):
... __slots__ = ('a', 'b')
... def __init__(self): self.not_allowed = 1
...
>>> a = A()
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "<interactive input>", line 3, in __init__
AttributeError: 'A' object has no attribute 'not_allowed'
>>>
Ciao
-----
FB
--
http://mail.python.org/mailman/listinfo/python-list