Message381486
How would you expect to extract this docstring?
I'm not sure how this would work in practice, since both of these are errors:
>>> class A:
... def __init__(self):
... self.x = 3
... self.x.__doc__ = 'foo'
...
>>> A()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in __init__
AttributeError: 'int' object attribute '__doc__' is read-only
>>> class B:
... x: int = 0
... x.__doc__ = 'foo'
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in B
AttributeError: 'int' object attribute '__doc__' is read-only
It could be stored in the dataclass-specific data attached to a class, but then you'd have to use a dataclass-specific function to get access to it. I'm not sure that's a great improvement.
I also note that attrs doesn't have this feature, probably for the same reason. |
|
Date |
User |
Action |
Args |
2020-11-20 15:57:14 | eric.smith | set | recipients:
+ eric.smith, jmg |
2020-11-20 15:57:14 | eric.smith | set | messageid: <1605887834.66.0.357398005881.issue42414@roundup.psfhosted.org> |
2020-11-20 15:57:14 | eric.smith | link | issue42414 messages |
2020-11-20 15:57:14 | eric.smith | create | |
|