I've seen this proposed before, but it is, as you said, a bit
arduous.

For dataclasses specifically, there is also another possibility:
add a `doc` argument to dataclasses.field. Like this:

from dataclasses import dataclass, field

@dataclass
class A:
    x: int = field(doc="Docstring for x.")
    y: bool = field(default=False, doc="Docstring for y.")

And then it would be retrievable with dataclasses.fields(A).

Thomas
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/K7VUWXZQYPUMTRT5S553HRFVDHC2LDRJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to