BuZZ-dEE BuZZ-dEE - 1 year ago 99
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?

Answer Source

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:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download