Don't use __slots__ (was Re: Why custom objects take so much memory?)

Aahz aahz at pythoncraft.com
Tue Dec 18 16:49:25 EST 2007


In article <mailman.2538.1198008758.13605.python-list at python.org>,
Chris Mellon <arkanes at gmail.com> wrote:
>
>You can reduce the size of new-style classes (inherit from object) by
>quite a bit if you use __slots__ to eliminate the class dictionary.

You can also reduce your functionality quite a bit by using __slots__.
Someday I'll have time to write up a proper page about why you shouldn't
use __slots__....
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Typing is cheap.  Thinking is expensive."  --Roy Smith



More information about the Python-list mailing list