This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix description in bytes literal doc
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eric.smith, xiang.zhang
Priority: normal Keywords: patch

Created on 2016-09-03 14:44 by xiang.zhang, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
lexical_bytes_literal.patch xiang.zhang, 2016-09-03 14:44 review
Messages (4)
msg274297 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-03 14:44
This sentence "bytes with a numeric value of 128 or greater must be expressed with escapes" is wrong and not complete. The value needs to be escaped is >= 127 and < 32.
msg274298 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2016-09-03 14:54
While they probably should be entered with escapes, there's no actual technical requirement for that.

From the command line, I can enter a control-A with control-V control-A (this might be different depending on your environment, or if you use an editor). This will enter a literal string containing a single character with value 1.

That gives:

>>> '^A'     # ^A is the combination control-V control-A
'\x01'
>>> len('^A')
1
>>> ord('^A')
1
>>> b'^A'
b'\x01'
msg274299 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-03 15:01
Ooh, sorry. It seems I misunderstand the meaning of the sentence. I understand the value as the output of repr, I mean b'\x01'. It means how it's created.

Thanks for your reply and sorry for the noise. I close this then.
msg274300 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2016-09-03 15:06
No problem! Thanks for caring enough to open an issue and submit a patch, even if we don't use it.
History
Date User Action Args
2022-04-11 14:58:35adminsetgithub: 72136
2016-09-03 15:06:20eric.smithsetmessages: + msg274300
stage: resolved
2016-09-03 15:01:23xiang.zhangsetstatus: open -> closed
resolution: not a bug
messages: + msg274299
2016-09-03 14:54:45eric.smithsetnosy: + eric.smith
messages: + msg274298
2016-09-03 14:44:33xiang.zhangcreate