On Thu, Nov 18, 2021 at 10:28 AM Ricky Teachey <ri...@teachey.org> wrote:

> Could this be a use case for typing.Annotated?
>
> ...
>
> The syntax is a bit arduous; I'd be in favor of thinking through ways to
> make it easier to write. But the basic functionality already exists;
> there's no reason to duplicate it with another language feature.
>
> Rick.
>

Whoops sorry, forgot the @dataclass decoration:

In [10]: @dataclass
    ...: class A:
    ...:     """Docstring for class A."""
    ...:     x: Annotated[int, "Docstring for x"]
    ...:     y: Annotated[bool, "Docstring for y"] = True
    ...:

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
_______________________________________________
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/3RQNYZ2IG7QOORECD2DXO7BQ27AROCGX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to