You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def foo(a, b):
return a + b
def bar(c, d):
return c, d
HANDLERS = {
"foo": foo,
"bar": lambda a, b: bar(a, b) # "fixes" to just bar
}
def handle(verb: str, payload):
a, b = payload
return HANDLERS[verb](a=a, b=b)
Here we're relying on the lambda to implement renaming of positional arguments. Removing the lambda expression would be incorrect despite an absence of side-effects. A correct refactor would be to rename the arguments to bar, or to eliminate the keyword invocation but the linter fix alone is unsafe despite listing itself as such.
The text was updated successfully, but these errors were encountered:
Example
Here we're relying on the lambda to implement renaming of positional arguments. Removing the lambda expression would be incorrect despite an absence of side-effects. A correct refactor would be to rename the arguments to
bar
, or to eliminate the keyword invocation but the linter fix alone is unsafe despite listing itself as such.The text was updated successfully, but these errors were encountered: