[issue1889] string literal documentation differs from implementation

Andrew Dalke report at bugs.python.org
Tue Jan 22 04:28:41 CET 2008


New submission from Andrew Dalke:

The reference manual documentation for raw string literals says

"""Note also that a single backslash followed by a newline is
interpreted as those two characters as part of the string, *not* as a line
continuation."""

This is not the observed behavior.

>>> s = """ABC\
... 123"""
>>> s
'ABC123'
>>> 

Line continuations are ignored by triple quoted strings.



In addition, the reference manual documentation for "\x" escapes says

| ``\xhh``        | Character with hex value *hh*   | (4,5) |

where footnote (4) stays

   Unlike in Standard C, at most two hex digits are accepted.

However, the implementation requires exactly two hex digits:

>>> "\x41"
'A'
>>> "\x4."
ValueError: invalid \x escape
>>> "\x4" 
ValueError: invalid \x escape
>>>

----------
components: Documentation
messages: 61484
nosy: dalke
severity: minor
status: open
title: string literal documentation differs from implementation
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1889>
__________________________________


More information about the Python-bugs-list mailing list