[Python-ideas] Add \e escape code
Chris Angelico
rosuav at gmail.com
Tue Jun 11 20:36:50 CEST 2013
On Wed, Jun 12, 2013 at 4:16 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> How would you add a new escape character in a backwards compatible
> way ?
>
> Adding new escape characters is not easy, since Python defaults
> to passing them through as-is, e.g. '\e' == '\\e'.
My understanding of [1] is that the feature of keeping them unchanged
is meant to be a debugging aid, not something you depend on. Use of
unescaped backslashes in non-raw string literals is already dangerous
to editing (if someone changes your Windows path name to c:\testing,
your code is broken). If a new version breaks someone's non-raw
literal "c:\everything", it was already broken.
[1] http://docs.python.org/3/reference/lexical_analysis.html#literals
ChrisA
More information about the Python-ideas
mailing list