bpo-26506: hex() documentation: mention "%x" % int (Original patch by Manvi B)#2479
bpo-26506: hex() documentation: mention "%x" % int (Original patch by Manvi B)#2479sharanry wants to merge 6 commits intopython:masterfrom
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Doc/library/functions.rst
Outdated
| also :func:`format` for more information. | ||
|
|
||
| >>> num = 14 | ||
| >>> format(num, '#b'), format(num, 'b') |
There was a problem hiding this comment.
I suggest to remove the num variable and just write 14 directly, to simplify examples (and easier to copy/paste).
Doc/library/functions.rst
Outdated
| '-0b1010' | ||
|
|
||
| If prefix "0b" is desired or not, you can use either of the following ways. See | ||
| also :func:`format` for more information. |
There was a problem hiding this comment.
I suggest to move the "See also..." sentence after the examples.
Doc/library/functions.rst
Outdated
| method that returns an integer. | ||
| If you want to convert an integer number to uppercase or lowercase hexadecimal | ||
| string either with prefix or not, you can use either of the following ways. See | ||
| also :func:`format` for more information. |
There was a problem hiding this comment.
Ditto, move "See also ..." above.
Doc/library/functions.rst
Outdated
| string either with prefix or not, you can use either of the following ways. See | ||
| also :func:`format` for more information. | ||
|
|
||
| >>> num=255 |
There was a problem hiding this comment.
Ditto: replace num by its value (and remove num).
|
"Original patch by Manvi B", hum, please put this string in the commit message (use "git commit --amend" for example to edit the commit message), and include the email: manvishab77@gmail.com. |
vstinner
left a comment
There was a problem hiding this comment.
(Please make suggested changes.)
|
Regarding the commit message, the core developer who merge this PR can manually type it in after they press the "Squash and merge" button :) |
Update functions.rst based on recommendations from haypo.
Doc/library/functions.rst
Outdated
|
|
||
| If prefix "0b" is desired or not, you can use either of the following ways. | ||
| See also : | ||
| func:`format` for more information. |
There was a problem hiding this comment.
This line is strange... I suggest to put "See also ..." sentence after the following ">>> ..." examples.
Original patch by Manvi B ( manvishab77@gmail.com)
|
@Haypo I have made the changes you asked. Please review them. |
Doc/library/functions.rst
Outdated
| >>> f'{14:#b}', f'{14:b}' | ||
| ('0b1110', '1110') | ||
|
|
||
| See also : |
There was a problem hiding this comment.
I don't understand why :func:format is splitted in two lines. I expect an error when building the doc. Please don't split this statement into two lines.
There was a problem hiding this comment.
I don't understand what you are saying. Could you please be more specific?
There was a problem hiding this comment.
You have ":" on line 102 and "func:format" on line 103. The documentation uses the Sphinx format. I don't think that your syntax is valid. Please write ":func:format" on the same line.
There was a problem hiding this comment.
Never mind i understood what you are saying. Thanks!
Doc/library/functions.rst
Outdated
| string either with prefix or not, you can use either of the following ways. | ||
| See also : | ||
|
|
||
| func:`format` for more information. |
There was a problem hiding this comment.
Please move "See also .." after the example.
Doc/library/functions.rst
Outdated
|
|
||
| If you want to convert an integer number to octal string either with prefix "0o" | ||
| or not, you can use either of the following ways. See also :func:`format` for | ||
| more information. |
There was a problem hiding this comment.
Same here. I already asked you to do that :-(
|
@Mariatta: Would you mind to take a look to confirm that the doc change is fine. I don't know if we can "merge" the two "See also ..." sentence of the hex() doc. I don't know if t's worth it. Maybe just put them in the same paragraph? |
|
I think we should ask the original author if she wants to submit the PR. |
|
I am the original contributor. I will look into it again and can submit the PR. |
I agree. I've just updated the Dev guide with guidance and protocol for converting the patches to PR:
Please do. |
|
|
||
| See also :func:`format` for more information. | ||
|
|
||
| See also :func:`int` for converting a hexadecimal string to an integer using a base of 16. |
There was a problem hiding this comment.
Hexadecimal and base of 16 seems redundant
There was a problem hiding this comment.
What I meant is an integer using base of 16, for eg., int('0xff', 16). If it is redundant, I can remove it.
|
|
||
| If x is not a Python :class:`int` object, it has to define an __index__() | ||
| method that returns an integer. | ||
| If you want to convert an integer number to uppercase or lowercase hexadecimal |
There was a problem hiding this comment.
. . . to an uppercase or lowercase . . .
Refs:
http://bugs.python.org/issue26506
Original patch by Manvi B