FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Walrus in comprehension can leak into PEP 695 scope · Issue #104640 · python/cpython · GitHub

/ cpython Public

Walrus in comprehension can leak into PEP 695 scope #104640

Description

Example:

>>> class B: pass
... 
>>> class X[T]([(x := 3) for _ in range(2)] and B): print(x)
... 
3

This is because a walrus in a comprehension assigns to the immediately enclosing scope, which is now the type parameter scope. I don't think this causes any concrete problem right now, but I don't like it because I'd like to preserve the invariant that type parameters are the only names that can be defined in PEP 695 scopes.

Linked PRs

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


Back | FazBrowse Home | New Git URL