homepage

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: raw byte strings are described in a confusing way
Type: enhancement Stage:
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: docs@python Nosy List: barry, docs@python, eric.araujo, georg.brandl, gvanrossum, j.chadwick, pitrou, terry.reedy
Priority: normal Keywords:

Created on 2012年01月09日 13:34 by barry, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
stringByteLiteralBR.docx j.chadwick, 2012年03月29日 13:52 Correct update to documentation
Messages (10)
msg150936 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2012年01月09日 13:34
The lexical analysis documentation says this:
http://docs.python.org/py3k/reference/lexical_analysis.html?highlight=raw%20bytes
"Bytes literals are always prefixed with 'b' or 'B';..."
"Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R';..."
But that would lead you to believe that to get raw byte strings you should use rb"foo". In fact, that's a SyntaxError in Python 2.6+ and Python 3. What *does* work though is br"foo".
Either Python should accept both spellings (harder) or the documentation should make it clear that the 'b' must preceded the 'r'.
msg150940 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年01月09日 15:15
> Either Python should accept both spellings
+1. Been annoyed several times by this.
msg150941 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2012年01月09日 15:18
On Jan 09, 2012, at 03:15 PM, Antoine Pitrou wrote:
>
>Antoine Pitrou <pitrou@free.fr> added the comment:
>
>> Either Python should accept both spellings
>
>+1. Been annoyed several times by this.
The 64ドルk question: is this a new feature or a bug? :)
msg150942 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年01月09日 15:35
> The 64ドルk question: is this a new feature or a bug? :)
Most certainly a feature...
msg150944 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2012年01月09日 15:44
On Jan 09, 2012, at 03:35 PM, Antoine Pitrou wrote:
>
>Antoine Pitrou <pitrou@free.fr> added the comment:
>
>> The 64ドルk question: is this a new feature or a bug? :)
>
>Most certainly a feature...
In that case, since we can only add the new prefixes to 3.3, I still think we
need to fix the documentation to remove the confusion for stable releases.
msg157046 - (view) Author: Joseph Chadwick (j.chadwick) Date: 2012年03月29日 13:43
The attached replaces the text for the documentation in 2.4.1 between the lexical definitions table and the escape sequence table. The only change is the following addition to the paragraph on string and byte literals prefixed by 'r' or 'R':
When a byte literal is prefixed with both 'r' or 'R' and 'b' or 'B', the b must precede the r, as in: 'Br', 'bR', or 'BR' and not 'Rb', 'rB', or 'RB'.
msg157047 - (view) Author: Joseph Chadwick (j.chadwick) Date: 2012年03月29日 13:52
I uploaded before making the final save, so the first document is incomplete.
(that's embarrassing)
msg157122 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012年03月30日 02:52
Thanks for the contribution. Could you post your suggested wording as a plain text file?
msg157123 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012年03月30日 02:53
Actually it’s fine, we already have the text in your message :)
msg199667 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013年10月13日 08:01
3.3 is now released with both "br" and "rb" allowed, and in 2.7 the current text looks good enough for me.
History
Date User Action Args
2022年04月11日 14:57:25adminsetgithub: 57953
2013年10月13日 08:01:56georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg199667

resolution: out of date
2012年03月30日 02:53:17eric.araujosetmessages: + msg157123
2012年03月30日 02:52:30eric.araujosetnosy: + eric.araujo
messages: + msg157122
2012年03月29日 14:19:53loewissetfiles: - stringByteLiteralBR.docx
2012年03月29日 13:52:28j.chadwicksetfiles: + stringByteLiteralBR.docx

messages: + msg157047
2012年03月29日 13:43:12j.chadwicksetfiles: + stringByteLiteralBR.docx

nosy: + j.chadwick
messages: + msg157046

type: enhancement
2012年01月14日 05:13:01terry.reedysetnosy: + terry.reedy

versions: - Python 3.1
2012年01月09日 15:44:35barrysetmessages: + msg150944
2012年01月09日 15:35:50pitrousetmessages: + msg150942
2012年01月09日 15:18:46barrysetmessages: + msg150941
2012年01月09日 15:15:20pitrousetnosy: + gvanrossum, pitrou
messages: + msg150940
2012年01月09日 13:34:21barrycreate

AltStyle によって変換されたページ (->オリジナル) /