Skip to content
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

Conversation

gousaiyang
Copy link
Contributor

@gousaiyang gousaiyang commented Jan 7, 2020

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)

Automerge-Triggered-By: @gpshead

@@ -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
Copy link
Member

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.

Copy link
Contributor Author

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).

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

@tirkarthi tirkarthi requested a review from gpshead January 11, 2020 05:13
@gousaiyang
Copy link
Contributor Author

I've revised the PR to avoid duplicating the separator examples per section. Suggestions are welcome.

@miss-islington
Copy link
Contributor

Thanks @gousaiyang for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 8, 2020
….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>
@bedevere-bot
Copy link

GH-18409 is a backport of this pull request to the 3.8 branch.

@gousaiyang gousaiyang deleted the doc_newin38_sys__unraisable__bytearray_hex_params branch February 8, 2020 00:52
miss-islington added a commit that referenced this pull request Feb 8, 2020
….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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants