[Python-Dev] __slots__ came from?

Tim Peters tim@zope.com
Wed, 14 Nov 2001 13:42:38 -0500


[Paul Dubois]
> I wanted to learn more about this __slots__ (proposal?)(decision?)
> because of the possible relationship to the Properties package that is
> part of Numeric/MA. I can't find the PEP that relates to it. Help?

__slots__ belong in PEP 253, but there's just a todo placeholder for them in
there now.  See Guido's 2.2 type/class tutorial for a pragmatic intro:

    http://www.python.org/2.2/descrintro.html

Also see "Properties" there!  2.2 __slots__ are largely a memory-saving
feature, 2.2 properties largely for computed attributes (a way to capture
setting, getting and deleting of specific attributes without needing
catch-all hooks (like __getattr__ and __setattr__)).  It's mondo cool stuff.