Quesion about the proper use of __slots__

bruno at modulix onurb at xiludom.gro
Mon Feb 20 08:30:07 EST 2006


Zefria wrote:
> Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM
> used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd
> prefer not to see things slipping into Swap space if I can avoid it,
> and the fighter data would be only part of a larger program.
> 
> And as I said, learning how to use __slots__ is important enough to
> hazard a premature guess this time around. If I mess up, the worst that
> happens is that I have to write down a new variable name in two places
> instead of one now.

Ok, but don't forget that using slots prevents you from attaching new
attributes on the fly on a given instance - which can be quite handy for
some use cases.


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list