You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should probably have a single convention for attribute and module-level variable annotations that would at least be recommended (even if other ways would also work).
Here are some potential approaches:
x = 0, x = '', etc. (at least for built-in types)
x = Undefined(int)
x = Undefined # type: int
# var x: int (a proposal for PEP 484, still under discussion)
Activity
JukkaL commentedon Apr 13, 2015
Another option:
x = None # type: int(the type will beint, notOptional[int])JukkaL commentedon Apr 13, 2015
Yet another option:
x = cast(int, None)vlasovskikh commentedon Jun 26, 2015
The PEP now allows specifying the type of a variable without specifying its value:
For variables with known default values we could use:
gvanrossum commentedon Jan 11, 2016
The PEP picked a syntax. It is used in many stubs, and mypy supports it. So I think this issue is fixed.
Merge pull request python#6 from cocoatomo/root-dir