[Python-ideas] Runtime-accessible attribute docstrings

2021-11-17 Thread tmkehrenberg
Hi all, I have seen discussion of docstrings for class attributes before on this list, but not with this exact proposal. My motivation is that I have a dataclass for which I want to write docstrings that can be accessed at runtime. In my specific case, the docstrings would be used to create a he

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-17 Thread Steven D'Aprano
On Wed, Nov 17, 2021 at 02:26:16PM -, [email protected] wrote: > @dataclass > class A: > """Docstring for class A.""" > x: int > """Docstring for x""" > y: bool = True > "Docstring for y" > > It is a bit awkward that the docstring is *below* the definition of the > at