I'm using docstrings bellow the attributes (analogous to functions and
classes), I think it works well.
It helps with distinguishing the class docstring from the arguments.

On 2021-12-08 13:25:55, Ricky Teachey wrote:
> On Wed, Dec 8, 2021 at 1:20 PM Paul Bryan <pbr...@anode.ca> wrote:
> > I believe a Annotated[..., str] could become an attribute docstring if by
> > consensus we deem it to be so. I can't see any disadvantages, perhaps save
> > for the verbosity of `Annotated`. It certainly seems like an advantage to
> > use an existing mechanism rather than define a new one that would appear to
> > require changes to the interpreter.
> 
> I think this would be better than nothing. But it is a little verbose. And
> it requires you to supply the type hint.
> 
> I use type hinting, but I don't want to use it every time I provide an
> Annotation/docstring.

In this case, why not use the current behaviour of putting the docstring
below the attribute?

Shouldn't typing be encouraged on dataclasses, at least?
_______________________________________________
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/SG33WQJCHQUG23NKETD6FCPSYIWP5U4T/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to