Inheritable Slots Metaclass
Aahz
aahz at pythoncraft.com
Mon May 31 14:55:09 EDT 2010
In article <5a3a5737-f1b7-4419-9bb3-088c244a4760 at c13g2000vbr.googlegroups.com>,
Carl Banks <pavlovevidence at gmail.com> wrote:
>
>However, Aahz will be by shortly to tell you never to use slots.
Please note that there is an important distinction between "don't use
slots" and "never use slots" -- if you can locate any instances where I
wrote the latter, I will be surprised and issue a retraction. Obviously,
slots are an important element of Python, but they should be used only
when other approaches have proven impractical.
To quote Guido:
__slots__ is a terrible hack with nasty, hard-to-fathom side
effects that should only be used by programmers at grandmaster and
wizard levels. Unfortunately it has gained an enormous undeserved
popularity amongst the novices and apprentices, who should know
better than to use this magic incantation casually.
See also
http://www.dalkescientific.com/writings/diary/archive/2006/03/19/class_instantiation_performance.html
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"If you don't know what your program is supposed to do, you'd better not
start writing it." --Dijkstra
More information about the Python-list
mailing list