This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author torsten
Recipients torsten
Date 2010-04-21.18:25:07
SpamBayes Score 2.5972335e-11
Marked as misclassified No
Message-id <1271874309.07.0.567011993617.issue8488@psf.upfronthosting.co.za>
In-reply-to
Content
[I would assign priority minor to this, but the tracker won't let me]

I really like the online documentation features of python. However, I wonder about the output of the following simple example:

class Descriptor(object):
    """Doc of a non-data descriptor."""
    def __get__(self, instance, owner):
        return 42 if instance else self

class GetSetDescriptor(Descriptor):
    """Doc of a data-descriptor."""
    def __set__(self, instance, value):
        pass

class Demo(object):
    non_data = Descriptor()
    data = GetSetDescriptor()

help(Demo)


This results in

Help on class Demo in module __main__:

class Demo(builtins.object)
 |  Methods defined here:
 |  
 |  non_data = <__main__.Descriptor object>
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  data
 |      Doc of a data-descriptor.


I think the behaviour of pydoc wrt. the non_data descriptor is a bit out of line. I would have expected to find the docstring in the output here.
History
Date User Action Args
2010-04-21 18:25:10torstensetrecipients: + torsten
2010-04-21 18:25:09torstensetmessageid: <1271874309.07.0.567011993617.issue8488@psf.upfronthosting.co.za>
2010-04-21 18:25:07torstenlinkissue8488 messages
2010-04-21 18:25:07torstencreate