[Python-Dev] Re: __slots__ and default values
Thomas Heller
theller@python.net
13 May 2003 17:45:34 +0200
Michael Chermside <mcherm@mcherm.com> writes:
> Combine this with the fact that newbies from staticly typed
> languages tend to think of __slots__ as "practically mandatory"
> (because it prevents the use of instance variables not pre-declared,
> which they erroniously think is a good thing) rather than the
> special purpose performance hack that it REALLY is, and you have
> a recipe for trouble.
Unrelated to *this* topic, but Andrew's "What's new in Python 2.2" still
presents __slots__ as a way to constrain the instance variables:
A new-style class can define a class attribute named __slots__ to
constrain the list of legal attribute names.
http://www.python.org/doc/current/whatsnew/sect-rellinks.html#SECTION000340000000000000000
This should probably be fixed.
Thomas