Skip to content

Disallow using Undefined in arbitrary expressions #555

Closed
@JukkaL

Description

@JukkaL

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions