[Python-Dev] slots, properties, descriptors, and pydoc

Fred L. Drake, Jr. fdrake at acm.org
Mon Apr 19 00:29:57 EDT 2004

On Sunday 18 April 2004 11:16 pm, John Belmonte wrote:
 > My intention was to make something that can completely replace the
 > current __slots__ pattern.  Your proposal doesn't support slots that
 > don't have a docstring very naturally (you'd use slot='').

Please don't misunderstand; I wasn't making a proposal, but was just 
responding to your question about what can be done.  I've no doubt something 
better can be done, and if anything is done as part of stock Python, it would 
need to be.

That said, docless slots would not be handled any differently with my sample 
code than they are now; just name them in __slots__.  My docslots() function 
was very careful not to blindly overwrite an existing __slots__.  So this:

    class Sample(object):
        __slots__ = "slot1",

would work just fine.


Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation

More information about the Python-Dev mailing list