In article <[EMAIL PROTECTED]>,
=?ISO-8859-1?Q?Sch=FCle_Daniel?= <[EMAIL PROTECTED]> wrote:
>
>does __slots__ nothing when used in derived classes?
Short answer: don't use __slots__ until you're comfortable writing
metaclasses and decorators. __slots__ are a performance hack strictly
for advance
Schüle Daniel wrote:
> consider this code
>
> >>> class A(object):
> ... def __init__(self):
> ... self.a = 1
> ... self.b = 2
> ...
> >>> class B(A):
> ... __slots__ = ["x","y"]
> ...
> >>> b=B()
> >>> b.a
> 1
> >>> b.b
> 2
> >>> b.x = 100
> >>> b.y = 100
> >>> b.
Schüle Daniel wrote:
> Hello,
>
> consider this code
>
> >>> class A(object):
> ... def __init__(self):
> ... self.a = 1
> ... self.b = 2
> ...
> >>> class B(A):
> ... __slots__ = ["x","y"]
> ...
> >>> b=B()
> >>> b.a
> 1
> >>> b.b
> 2
> >>> b.x = 100
> >>> b
Hello,
consider this code
>>> class A(object):
... def __init__(self):
... self.a = 1
... self.b = 2
...
>>> class B(A):
... __slots__ = ["x","y"]
...
>>> b=B()
>>> b.a
1
>>> b.b
2
>>> b.x = 100
>>> b.y = 100
>>> b.z = 100
no exception here
does __slots__