-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
Doc: sys.__unraisablehook__ and bytearray.hex separators are new in 3.8 #17884
Doc: sys.__unraisablehook__ and bytearray.hex separators are new in 3.8 #17884
Conversation
Doc/library/stdtypes.rst
Outdated
@@ -2518,8 +2518,26 @@ objects. | |||
>>> bytearray(b'\xf0\xf1\xf2').hex() | |||
'f0f1f2' | |||
|
|||
If you want to make the hex string easier to read, you can specify a |
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.
This was already documented at https://github.com/python/cpython/pull/13578/files#diff-7498e907ba97646df434a0eb583c6909R2407 to be new in Python 3.8 and looks like a duplicate addition.
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.
The case is that bytes.hex(sep=..., bytes_per_sep=...)
is already documented to be new in 3.8, but bytearray.hex(sep=..., bytes_per_sep=...)
is not (the versionchanged:: 3.8
indicator is missing). The "If you want to make the hex string easier to read" paragraph is actually copied from the document of bytes.hex
(just in the PR you mentioned).
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.
And memoryview.hex(sep=..., bytes_per_sep=...)
also need to be marked as new in 3.8.
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 feel it's better to add the versionchanged
directive to bytearray and memoryview but not sure about duplicating the examples per section. Adding initial docs author for review.
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.
thanks! this looks good, i like that you just link back to bytes.hex for the detailed description.
I've revised the PR to avoid duplicating the separator examples per section. Suggestions are welcome. |
Thanks @gousaiyang for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
….8 (pythonGH-17884) Minor fix in documentation: - `sys.__unraisablehook__` is new in version 3.8 - Optional `sep` and `bytes_per_sep` parameters for `bytearray.hex` is also supported in Python 3.8 (just like `bytes.hex`) (cherry picked from commit 0edc2c7) Co-authored-by: Saiyang Gou <gousaiyang@163.com>
GH-18409 is a backport of this pull request to the 3.8 branch. |
….8 (GH-17884) Minor fix in documentation: - `sys.__unraisablehook__` is new in version 3.8 - Optional `sep` and `bytes_per_sep` parameters for `bytearray.hex` is also supported in Python 3.8 (just like `bytes.hex`) (cherry picked from commit 0edc2c7) Co-authored-by: Saiyang Gou <gousaiyang@163.com>
Minor fix in documentation:
sys.__unraisablehook__
is new in version 3.8sep
andbytes_per_sep
parameters forbytearray.hex
is also supported in Python 3.8 (just likebytes.hex
)Automerge-Triggered-By: @gpshead