A bug for raw string literals in Py3k?

Ben Finney ben+python at benfinney.id.au
Sun Oct 31 18:41:29 EDT 2010


John Machin <sjmachin at lexicon.net> writes:

> On Oct 31, 11:23 pm, Yingjie Lan <lany... at yahoo.com> wrote:
> > Thanks! That looks weird to me ... doesn't this contradict with:
> >
> > All backslashes in raw string literals are interpreted literally.
> > (seehttp://docs.python.org/release/3.0.1/whatsnew/3.0.html):
>
> All backslashes in syntactically-correct raw string literals are
> interpreted literally.

That's a good way of putting it.

Yingjie, in case it's not clear: Python can only know what you've
written if it's syntactically correct. The backslash preceding the final
quote means that the code contains bad syntax, not a raw string literal.

Since there's no raw string literal, “backslashes in raw string
literals” doesn't apply.

-- 
 \      “If sharing a thing in no way diminishes it, it is not rightly |
  `\      owned if it is not shared.” —Augustine of Hippo (354–430 CE) |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list