How can I document a variable in Python. In JavaScript / JSDoc I can do something like that.:
/** @type {Array<Number>} */
var foo;
/** @type {Number[]} */
var bar;
Some IDEs than can give better code completion.
Is this also possible in Python?
x, y, z = [], [], [] # type: (List[int], List[int], List[str]) is how it is defined in the spec ... your particular IDE may or may not implement it in this way ...
see also: https://www.python.org/dev/peps/pep-0484/#type-comments
# type: list[int]instead of# type: List[int]. Is that correct? It also seems that PyCharm supports it.x, y, z = [], [], [] # type: (List[int], List[int], List[str])is how it is defined in the spec ... your particular IDE may not implement it in this way ...