Recently I wanted to reuse doc-sting of class attributes to make some user-friendly self-description but could not find a way to access a doc-string of the attribute of the class.
Consider example:
>>> class Foo(object):
... """I am a doc-string of the foo class"""
... bar: int = 42
... """I am a doc-string of the bar attribute"""
...
>>> Foo.__doc__
'I am a doc-string of the foo class'
>>> Foo.bar.__doc__
"int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4"
Accessing doc-sting of an attribute of the class give a docstring of the annotated type.
Is it even possible at all, preferably without extra libarries or imports?