Message381492
As I said, I expect it to work similar to how property works:
```
>>> class Foo:
... def getx(self):
... return 5
... x = property(getx, doc='document the x property')
...
>>> help(Foo)
Help on class Foo in module __main__:
class Foo(builtins.object)
| Methods defined here:
|
| getx(self)
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| x
| document the x property
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
```
The pure python implementation of property is at: https://docs.python.org/3/howto/descriptor.html#properties
which uses the descriptor protocal as documented in: https://docs.python.org/3/howto/descriptor.html
Which uses an object w/ __get__/__set__/__delete__ to emulate attribute access, and that object can have the __doc__ property set on it to provide documentation. |
|
Date |
User |
Action |
Args |
2020-11-20 18:18:30 | jmg | set | recipients:
+ jmg, eric.smith |
2020-11-20 18:18:30 | jmg | set | messageid: <1605896310.08.0.662421352734.issue42414@roundup.psfhosted.org> |
2020-11-20 18:18:30 | jmg | link | issue42414 messages |
2020-11-20 18:18:29 | jmg | create | |
|