Closed
Description
Using Undefined
should only be valid as an initializer in an assignment statement (but not as a subexpression of an initializer). These should be disallowed:
if x is Undefined: ...
y = [Undefined] # type: ...
def f(a: int = Undefined) -> int: ...
These should still be fine:
x = Undefined # type: int
y = Undefined(int)
Not sure about this one:
a, b = Undefined, Undefined # type: (int, str)
Currently Undefined
can be used as an expression.
See also python/typing#20 (comment).