-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E741: Inconsistent behavior for lambdas #959
Comments
I believe it's just a mistake that this isn't handled for lambdas the rule is correct for the list comprehension due to the ability to confuse: foo = [l for l in lines if l]
foo = [1 for l in lines if 1] |
asottile
changed the title
Inconsistent behavior for E741
E741: Inconsistent behavior for lambdas
Aug 12, 2020
I have this issue, but in my case it is clearly inconsistent: COMP_OPERATIONS = {
"==": lambda l, r: l == r, # This is falgged
">=": lambda l, r: l >= r, # This is falgged
"<=": lambda l, r: l <= r, # This is falgged
">": lambda l, r: l > r, # This is not flagged
"<": lambda l, r: l < r, # This is not flagged
} |
@pktiuk yeah it's not enabled for lambdas at all at the moment -- it's detecting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems like E741 shouldn't apply to variable names inside of comprehensions, due to the limited scope of such variables. If that's the desired behavior anyways, this behavior seems inconsistent to me:
The text was updated successfully, but these errors were encountered: