msg150936 - (view) |
Author: Barry A. Warsaw (barry) *  |
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) *  |
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) *  |
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 $64k question: is this a new feature or a bug? :) |
|
|
msg150942 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2012-01-09 15:35 |
> The $64k question: is this a new feature or a bug? :) Most certainly a feature... |
|
|
msg150944 - (view) |
Author: Barry A. Warsaw (barry) *  |
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 $64k 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) *  |
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) *  |
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) *  |
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. |
|
|