[New-bugs-announce] [issue13744] raw byte strings are described in a confusing way

Barry A. Warsaw report at bugs.python.org
Mon Jan 9 14:34:22 CET 2012


New submission from Barry A. Warsaw <barry at python.org>:

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

----------
assignee: docs at python
components: Documentation
messages: 150936
nosy: barry, docs at python
priority: normal
severity: normal
status: open
title: raw byte strings are described in a confusing way
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13744>
_______________________________________


More information about the New-bugs-announce mailing list