I'm basically a beginner when it comes to Python, and the other day I really wanted to get the most out of the VS Code tooltip that renders docstrings and type hints. So I spent all day reading and testing and as far as I could tell, the only situation where you can annotate variables to display a comment in this tooltip is for class variables.
Eventually my thought process led me to try this:
import time
class Var:
x = 0
'''0, 1, or 2'''
def foo():
class Var:
x:time.time
'''Time in seconds since the Epoch'''
Var.x = time.time_ns()
print(Var.x)
def bar():
class Var:
x: int = 0
