[ python-Bugs-1108060 ] "\0" not listed as a valid escape in the
lang reference
SourceForge.net
noreply at sourceforge.net
Mon Jan 24 05:02:15 CET 2005
Bugs item #1108060, was opened at 2005-01-24 13:09
Message generated for change (Comment added) made by spiv
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1108060&group_id=5470
Category: Documentation
Group: Not a Bug
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Andrew Bennetts (spiv)
Assigned to: Nobody/Anonymous (nobody)
Summary: "\0" not listed as a valid escape in the lang reference
Initial Comment:
According to table in
http://docs.python.org/ref/strings.html, the list of
valid escape sequences in strings does not include \0.
It appears that the parser actually allows \n for
values of n in the range 0-7, but this is not documented.
Many people with exposure to C expect \0 to be valid
(and it does work, after all!). A quick grep on my
system finds many libraries use \0 in string literals,
including:
- Twisted
- HTMLgen
- PIL
- numarray
- Reportlab
- and of course the standard library: tarfile, gzip,
pystone, binhex, and others.
I suggest the documentation be updated to officially
support \0 as a valid escape. I don't care as much
about \1 through to \7... I was surprised they worked
(and then surprised that \8 and \9 didn't), and I think
they might as well be deprecated, but I don't care much
either way.
----------------------------------------------------------------------
>Comment By: Andrew Bennetts (spiv)
Date: 2005-01-24 15:02
Message:
Logged In: YES
user_id=50945
So it does. I suck. Thanks Tim!
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2005-01-24 14:21
Message:
Logged In: YES
user_id=31435
Look at the table of escapes again, especially the line with
footnotes 3 and 5; that line documents the octal escapes,
including all cases you've mentioned here.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1108060&group_id=5470
More information about the Python-bugs-list
mailing list