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
There is a bad fixit generated by ruff for FURB118 with operator.itemgetter().
It tries to replace this line:
returnlambdax: (x[index],)
with this line
returnoperator.itemgetter(index)
However, these are not equivalent, in the first instance, the code will return a 1 element tuple, while in the second one, it will just return that element.
The text was updated successfully, but these errors were encountered:
Skylion007
changed the title
FURB118 bug: does not recognize 1 element tuples
FURB118 bug: incorrectly replaces 1 element tuple lambdas with itemgetter
Apr 21, 2024
…ple (#11095)
## Summary
The `operator.itemgetter` behavior changes where there's more than one
argument, such that `operator.itemgetter(0)` yields `r[0]`, rather than
`(r[0],)`.
Closes#11075.
There is a bad fixit generated by ruff for FURB118 with operator.itemgetter().
It tries to replace this line:
with this line
However, these are not equivalent, in the first instance, the code will return a 1 element tuple, while in the second one, it will just return that element.
The text was updated successfully, but these errors were encountered: