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
Undocumented method for "slice" class #99121
Comments
|
I found this by searching for "indices": https://docs.python.org/3/reference/datamodel.html?highlight=indices#slice.indices
|
|
The documentation for the The comment "they are used by NumPy and other third-party packages" seems to be irrelevant. Most builtins are used by numpy and other third-party packages. I think that comment might be a left-over from ancient Python 1.5 when extended slicing with a step had been added to the language for numpy but no builtins used it yet? Maybe I am misremembering. Either way, I think we can also remove the bit about numpy and third party packages. |
|
You're looking at the built-in functions page. That's the wrong place. That doesn't contain documentations of the whole types. The built-in types page does. The |
|
Thanks, I've updated PR #99129. I also removed the NumPy bit, please let me know if that should stay, and if the text should be reflowed. |
WANGCHEN722 commentedNov 5, 2022
•
edited by bedevere-bot
Documentation
The "slice" class has a method "indices" that, when given a length of a sequence, will return a tuple with (start, stop, step) that is adjusted for the length of that sequence. This method is completely undocumented
For example,
The only example that I could find in any official Python documents is this, there is a single reference to this method at the bottom of the page. However, as of the lastest version of Python, which is 3.11.0 at the time of writing, using this method in a standard installation of CPython still works.
The text was updated successfully, but these errors were encountered: