Skip to content

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

Closed

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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