[Python-bugs-list] [ python-Bugs-542226 ] octal escape doc contradiction
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 10 Apr 2002 16:06:53 -0700
Bugs item #542226, was opened at 2002-04-11 09:06
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=542226&group_id=5470
Category: Regular Expressions
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: John Machin (sjmachin)
Assigned to: Fredrik Lundh (effbot)
Summary: octal escape doc contradiction
Initial Comment:
Python version 2.2.1, Library Reference, section
4.2.1
Following is old, correct
text:
\number
[snip]
If the first digit of number is 0, or
number is 3 octal digits long, it will not be interpreted as a group
match, but as the character with octal value number.
At the end
of the section, the following has been appended
recently:
"""Note that octal escapes are not included. While
the parser can attempt to determine whether a character is being
specified by it's ordinal value expressed in octal, doing so yields
an expression which is relatively difficult to maintain, as the
same syntax is used to refer to numbered groups. """
The first
sentence is quite incorrect; remove it.
>>>
re.sub("\157\157", "\165", "foobar")
'fubar'
>>>
The
second sentence would even if cleaned up and made correct would
still be out of place in this manual; remove it.
Also document
that octal numbers are interpreted modulo \400:
>>>
re.sub("\557\157", "\165", "foobar")
'fubar'
>>>
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=542226&group_id=5470