[New-bugs-announce] [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

This is not the observed behavior.

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

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"
>>> "\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>

More information about the New-bugs-announce mailing list