On Thu, Nov 18, 2021 at 10:28 AM Ricky Teachey <ricky@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