8000 Infer variable type if initializer is None · Issue #1099 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
Infer variable type if initializer is None #1099
Closed
@JukkaL

Description

@JukkaL

Mypy should infer the type of a variable if the first initializer is None:

def f() -> None:
    x = None
    if foo:
        x = ''
    # type of x should be str here

Metadata

Metadata

Assig 367F nees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0