[Python-Dev] slots, properties, descriptors, and pydoc (original) (raw)

John Belmonte john at neggie.net
Sun Apr 18 08:45:29 EDT 2004


Guido van Rossum wrote:

3) extend the slots handler to set the descriptor's doc string to dictionary values if the slot's value is a dictionary.

I haven't implemented this, because I don't know a thing about Python's C interface. If someone more able would knock off a prototype, I would be grateful. If I understand this proposal correctly (the dict values would provide the docstrings for the slots) I'd rather not make this default behavior; different metaclasses may want to use the dict value for different purposes, and subsuming it by default for the doc string would make that harder to do.

Ok. Can anyone suggest an unobtrusive way to set docstrings on slots?

Perhaps this (but how could it be implemented?):

 class Foo(object):
     __slots__ = docslots(
         ('slot1': 'description'),
         ('slot2':
             """description
             ...continued
             """),
         'slot3',
     )

-John

-- http:// if ile.org/



More information about the Python-Dev mailing list