-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
FURB118, lambda x: x[:, 0]
should be itemgetter((slice(None), 0))
, instead of itemgetter((:, 0))
#13508
Comments
The python slice index syntax always trips me up and in this case it's unclear to me what the result of the map operation is. @nasyxx could you clarify. Do you expect the above to be valid code? I'm asking to better understand if this is a bug in the fix or that the rule shouldn't flag the above code. CC: @AlexWaygood |
Hi, the above is valid, while it will raise IndexError. My actual ndarray is quite complex, you can change |
There's definitely a serious bug here: we currently suggest invalid syntax (and, if you run with - lambda x: x[:, 0]
+ import operator
+ operator.itemgetter((:, 0)) In my opinion, |
There was already handling for the singleton `x[:]` case but not the tuple case.\nCloses #13508
There was already handling for the singleton `x[:]` case but not the tuple case.\nCloses #13508
We already handle converting |
There was already handling for the singleton `x[:]` case but not the tuple case.\nCloses #13508
In refurb, FURB118,
lambda x: x[:, 0]
should beitemgetter((slice(None), 0))
, instead ofitemgetter((:, 0))
I guess
(:, 0)
is not a valid tuple.The text was updated successfully, but these errors were encountered: