Skip to content

[F812] Warn when list comprehension redefines a name#276

Open
ansley wants to merge 2 commits into
gh/"ansley"/6/basefrom
gh/"ansley"/6/head

Hidden character warning

The head ref may contain hidden characters: "gh/"ansley"/6/head"
Open

[F812] Warn when list comprehension redefines a name#276
ansley wants to merge 2 commits into
gh/"ansley"/6/basefrom
gh/"ansley"/6/head

Conversation

@ansley

@ansley ansley commented Mar 8, 2023

Copy link
Copy Markdown

Stack from ghstack (oldest at bottom):

This lint rule is probably in Flake8 to prevent elements from leaking
out of the comprehension scope, but the behavior was fixed in Python3.
I worry such a strict lint rule will cause more problems than it solves,
considering we use Python 3.10 at Meta. Perhaps we should consider
disabling this rule by default.

This lint rule is probably in Flake8 to prevent elements from leaking
out of the comprehension scope, but the behavior was fixed in Python3.
I worry such a strict lint rule will cause more problems than it solves,
considering we use Python 3.10 at Meta. Perhaps we should consider
disabling this rule by default.

[ghstack-poisoned]
This lint rule is probably in Flake8 to prevent elements from leaking
out of the comprehension scope, but the behavior was fixed in Python3.
I worry such a strict lint rule will cause more problems than it solves,
considering we use Python 3.10 at Meta. Perhaps we should consider
disabling this rule by default.

[ghstack-poisoned]

@amyreese amyreese left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some test cases covering mutually exclusive scopes, where I would expect this to be allowed?

Something like:

def foo():
    i = 1
    print(i)

def bar():
    values = [i * 2 for i in range(5)]

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. lint rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants