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

John Belmonte john at neggie.net
Sun Apr 18 23:16:17 EDT 2004

Fred L. Drake, Jr. wrote:
> How about:
>     class Foo(object):
>        docslots(slot1='description',
>                 slot2=("Some really long\n"
>                        "multi-line description."),
>                 ...)

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='').

Attached is another strategy that uses optional tuples.  Combined with 
my pydoc patch,

     class Foo(object):
             ('slot1', 'description'),
             ('slot2', """description
             ('_slot4', 'hidden'),

yields this help:

     class Foo(__builtin__.object)
      |  Data descriptors defined here:
      |  slot1
      |      description
      |  slot2
      |      description
      |      ...continued
      |  slot3


http:// if  ile.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slots.py
Type: text/x-python
Size: 2050 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20040418/d4400ae9/slots.py

More information about the Python-Dev mailing list