-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
CLN: Add allow_slice to is_hashable function #62567
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
base: main
Are you sure you want to change the base?
Conversation
|
Are there non-test places where this is needed? |
not so far. Because in your PR(#53743 (comment)) you added the checks along with the call to is_hashable(). I added this 'allow_slice' argument based on Richard's suggestion (#55152 (comment)) Let me make some changes to some of the callers and set 'allow_slice' to be False. |
| # This should never be reached, but let's be explicit about it | ||
| raise ValueError("Too many indices") # pragma: no cover | ||
| if all( | ||
| (is_hashable(x) and not _contains_slice(x)) or com.is_null_slice(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is the only usage of _contains_slice, so that can be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LirongMa can you address this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the _contains_slice function still exists a few lines up
| def __hash__(self): | ||
| raise TypeError("Not hashable") | ||
|
|
||
| class HashableSlice: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment that we can get rid of that once we drop py311?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont see a comment
Changes for #55152
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.