[Python-bugs-list] escaping '\' (PR#420)

tim_one@email.msn.com tim_one@email.msn.com
Sat, 29 Jul 2000 04:33:17 -0400 (EDT)


Jeff, if you don't send an actual program or screen dump showing the
problem, we can't reproduce it or (often) guess what you mean.

In this case, you're almost certainly suffering from an illusion due to
typing the examples at an interactive command prompt (but since you didn't
show us exactly what you did, I can't be sure of that).  Read the docs for
the difference between str() and repr(); raw expressions at an interactive
prompt are automatically run through repr() before display.  Or ponder this
actual screen dump:

>>> "\\hello\\"
'\\hello\\'
>>> print "\\hello\\"
\hello\
>>> len("\\hello\\")
7
>>>

All the cases you present work as documented -- but not the way you *think*
they do!

> -----Original Message-----
> From: python-bugs-list-admin@python.org
> [mailto:python-bugs-list-admin@python.org]On Behalf Of
> jeff.richards@whiplashnow.com
> Sent: Friday, July 28, 2000 12:56 PM
> To: python-bugs-list@python.org
> Cc: bugs-py@python.org
> Subject: [Python-bugs-list] escaping '\' (PR#420)
>
>
> Full_Name: Jeff Richards
> Version: 1.5.2
> OS: NT4
> Submission from: michael.divineinterventures.com (208.203.56.130)
>
>
> Backslash does not work as per language spec.
>
> Example:  "\\hello\world"
> result:   '\\hello\\world'  - Extra backslash added, first backslash not
> collapsed
>
> Example: "\\hello\\world"
> Result   "\\hello\\world"  - No backslashes are collapsed
>
> Example: "hello\there"
> Result:  "hello\011there" - \t converted to \011, this is correct
>
> Example: "\hello\\there"
> Result:  "\\hello\\there" - \\t converted to \\t, this is wrong, first \
> converted to \\ - this is wrong
>
>
>
>
>
> _______________________________________________
> Python-bugs-list maillist  -  Python-bugs-list@python.org
> http://www.python.org/mailman/listinfo/python-bugs-list