Expanding on that idea: if language support for making use of this documentation convention is indeed later wanted but it were deemed too problematic, and potentially backwards incompatible, to differentiate docstrings from regular typing information, there could be a docstring literal d"", similar to f string literal:
@dataclass
class A:
"""Docstring for class A."""
x: d"Docstring for x"
y: d"Docstring for y"
x: int
y: bool = True
To be clear there is nothing magical about the d"" string itself. It's just a regular string. The d"" moniker merely causes the string contents to be stored away for safe keeping in a class or module dunder, storing all the info for the created docstrings in a dictionary:
>>> print(A.__member_docstrings__)
{'x': 'Docstring for x', 'y': 'Docstring for y'}
Using only convention, you could do all sorts of fancy shenanigans with these docstrings.
You could provide format fields in the docstring.... such as using a convention for identifying the variable name on the LHS inside the docstring, or its type hint (type hint maybe defaulting to Any if there isn't a type hint?):
class A:
"""Docstring for class A."""
x: d"{var} is of type {hint}"
y: d"{var} is of type {hint}"
Documentation tools line help() could know about __member_docstrings__ and these conventions, properly parse them using the format() method:
>>> help(A.x)
x is of type Any
In this way the help function or other documentation tools wouldn't require type hint information, and a type hint could even be defined/changed later (such as in a child class).
class B(A):
"""Docstring for class B."""
x: int
>>> help(A.x)
x is of type int
I'm unsure how the help() function, or other similar documentation tools, could know where to look (ie, in the parent class) for the docstring information. Seems like this could be solved in some way, though.