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
simplify int() signature docs #60240
Comments
This issue is to simplify the documentation of the built-in function int()'s signature: int([number | string[, base]]) and to make any needed changes to the text of the docs as a consequence. Discussion around this issue began in the comments to bpo-14783 about int() and str()'s docstrings. [I copied the nosy list from that issue.] |
[Continuing the bpo-14783 discussion]
I also feel that *x* should be used, since that is what the code enforces. I'm attaching a revised patch. This patch also makes related adjustments to the corresponding text. |
I'm attaching an updated patch that does not cover certain edge cases that may differ for other Python implementations (and in fact does differ for PyPY). See bpo-16045 for more information. |
The latest patch is better, however I think it can be further improved. The text is currently divided in two paragraphs:
I think it would be better to cover first int(), int(num), int(float), and then cover int(x, base=b). The attached patch does this. |
Latest patch LGTM. |
Good improvement. LGTM. |
Ezio, do you want to commit this or should I? |
Attaching updated patch that clarifies the accepted non-numeric types as Serhiy suggested on Rietveld. I also made a few other changes like linking to "integer literal" and updating the "base-radix" reference. As I began to suspect, the latter was left over from a prior version of the docs (when the keyword argument was named "radix"): http://hg.python.org/cpython/file/18db8c4d4487/Doc/library/functions.rst#l559 I will commit later today unless there are further suggestions. |
New changeset 9205277bc008 by Chris Jerdonek in branch '3.2': New changeset 6ccb04c4cbae by Chris Jerdonek in branch 'default': |
Leaving open until the change is made in 2.7 (the current wording is somewhat different there). I will do that in the next day or so. |
See the following comment to bpo-16045 for a couple differences in the behavior of int() in 2.7: |
Attaching patch updated for backport to 2.7. In cases where the 2.7 language was substantively different, I preserved the 2.7 language (e.g. I preserved the reference to plain and long integers). I also added the lone "0" prefix for octals, which is a difference from 3.x: |
[Django/Rietveld is erroring out for me when I try to reply there, so replying here] On 2012/10/01 01:45:03, cvrebert wrote:
cvrebert, this patch has already been committed to 3.x. Maybe open a new issue if you think the language can be improved further? (Feel free to add me to the nosy list.) This issue was originally focused more on updating just the signature line (along with any consequent changes to the text). |
New changeset ed76eac4491e by Chris Jerdonek in branch '2.7': |
Chris (cvrebert), feel free to create a new issue to improve the int() docs further. |
New changeset e4598364ea29 by Chris Jerdonek in branch '3.2': |
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: