BuZZ-dEE BuZZ-dEE - 6 months ago 44
Python Question

How to document a Python variable?

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: