Message103880
[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. |
|
Date |
User |
Action |
Args |
2010-04-21 18:25:10 | torsten | set | recipients:
+ torsten |
2010-04-21 18:25:09 | torsten | set | messageid: <1271874309.07.0.567011993617.issue8488@psf.upfronthosting.co.za> |
2010-04-21 18:25:07 | torsten | link | issue8488 messages |
2010-04-21 18:25:07 | torsten | create | |
|