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

Fred L. Drake, Jr. fdrake at acm.org
Sun Apr 18 10:13:19 EDT 2004


On Sunday 18 April 2004 08:45 am, John Belmonte wrote:

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

 class Foo(object):
     __slots__ = docslots(
         ('slot1': 'description'),
         ('slot2':

How about:

class Foo(object):
   docslots(slot1='description',
            slot2=("Some really long\n"
                   "multi-line description."),
            ...)

The implementation for docslots() would either provide or update slots, and defining properities for slots with munged names. This wouldn't actually be difficult to implement, though is would require a sys._getframe() hack.
In fact, you could crib from the attached sample. ;-)

-Fred

-- Fred L. Drake, Jr. PythonLabs at Zope Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: docslots.py Type: text/x-python Size: 1169 bytes Desc: not available Url : http://mail.python.org/pipermail/python-dev/attachments/20040418/6aaee156/docslots.py



More information about the Python-Dev mailing list