21 Jan
2020
21 Jan
'20
8:45 p.m.
Currently, there is no way to add docstrings to fields in dataclasses. PEP257 talks about attribute docstrings (a string literal following an assignment), but these are visual only and not accessible at runtime. My suggestion would be a simple `doc` or `docstring` parameter to dataclasses.field(). Currently the best way to get anything close to this is using metadata, which is much clunkier: `dataclasses.field(metadata={'docstring': 'my description'})`