Terry J. Reedy <tjre...@udel.edu> added the comment:
Documenting dataclass fields strikes me as a reasonable request. Since most most field values cannot have a .__doc__ attribute... > It could be stored in the dataclass-specific data attached to a class, The obvious place. > but then you'd have to use a dataclass-specific function to get access to it. There are already at least 2 functions for getting docstrings for objects without .__doc__. They could be enhanced with a dataclass-specific clause. If ob.__doc__ is None, inspect.getdoc(ob) looks for a docstring elsewhere and sometimes succeeds. For this reason, I just changed IDLE calltips to use getdoc for calltips. If dataclasses.is_dataclass(ob.__class__), then I presume getdoc could retrieve the docstring from ob.__class__.__dataclass_fields__. help(ob) uses pydoc, which gets docstrings with _getowndoc and if needed, _finddoc. Perhaps these should be replaced with inspect.getdoc, but until then, _finddoc could have an elif clause added for dataclass fields. ---------- nosy: +terry.reedy stage: -> test needed _______________________________________ 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