Skip to content

With statement 'as' target cannot be arbitrary lvalue #542

Closed
@JukkaL

Description

@JukkaL

Code like this should be valid, but mypy complains about it:

y={}
with open('x.txt') as y[1]:
    print(y[1])

Mypy only allows a name to be on the rhs of as, but any lvalue should be valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions