Useful? __slots__ for functions

Michele Simionato michele.simionato at poste.it
Tue May 25 23:22:13 EDT 2004


Jean Brouwers <mrjean1 at comcast.net> wrote in message news:<240520042236356939%mrjean1 at comcast.net>...

> In addition to being faster (to create) and smaller, __slots__ objects
> have another major advantage, at least in my view.  They are 'frozen'
> and can not be extended dynamically, not intentionally and -even more
> importantly- not by accident.  There are situations where the latter is
> a major benefit, for example in applications where extensibility is not
> a requirement.

Aarghh! This is a wart of __slots__, not an advantage. See
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158
and google the newsgroup for __slots__.

         Michele Simionato



More information about the Python-list mailing list