Andrei Kulakov <andrei....@gmail.com> added the comment:

I've put up a simple PoC PR adding a __field_doc__ optional dict attr to 
dataclass, which would add the docs to class docstring:

@dataclass
class A:
    __field_doc__ = dict(num='number of widgets', total='total widgets')
    total: int
    num: int = 5
print(A.__doc__)

OUTPUT
---

A(total: int, num: int = 5)

num: int [5] -- number of widgets

total: int  -- total widgets

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42414>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to