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
Position index limit; s.insert(i,x) not same as s[i:i]=[x] #47542
Comments
Suggested changes to Lib Ref Manual: Sequence Types --...(3.6 for 2.5) (These are mostly based on an issue posted on c.l.p. The Plone Main section: Before the operation list, change "n, i and j are integers:" to "n, i, After the above, add "An implementation may limit the range of position Consider using i only as a magnitude-limited position index (an Mutable Sequence Types In 3.0, .count and .index are general sequence methods and should be The line "s.insert(i, x) same as s[i:i] = [x]" is not true when i is Is there a policy on documenting possible operation-specific exceptions? For 3.0, footnotes 3 and 7 (in this subsection) document 2, for 4 In the main section, for s[i]: In the subsection, for s.insert(i,x): I actually think the OverflowError should be changed to IndexError since |
Please bring it up on python-dev. |
Had this actually been brought up? |
There were two somewhat independent sections to my post:
Georg, if I grab a copy from svn, edit (respecting .rst markup), and
|
Yes, I'll be happy to review, edit and commit any patch you send me.
Okay :) |
Added the i,j,k notes Left out the processor word size and C-type specifications in-part because it is an implementation detail subject to change. Another reason is that it doesn't apply to necessarily to all sequences. Slices take arbitrary objects and with applied to an object's __getitem__, the object itself is responsible for handling it. Also, the size limits are already reflected in the maximum sizes for the object (a list can't get bigger that Py_ssize_t, so of course, its indicies are similarly bounded). Adding more text here is leaning towards over-specification of implementation specific details and make the docs harder to read while not adding anything truly helpful. In particular, it is more harmful than helpful to focus on the edge case where "s.insert(i, x) is not the same as s[i:i] = [x]" when i==sys.maxsize-1. |
See r3292. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: