[Python-Dev] PEP 30XZ: Simplified Parsing

Guido van Rossum guido at python.org
Thu May 3 20:35:50 CEST 2007


On 5/3/07, Georg Brandl <g.brandl at gmx.net> wrote:
> > These are raw strings if you didn't notice.
>
> It's all in the implementation. The tokenizer takes it as an escape sequence
> -- it doesn't specialcase raw strings -- the AST builder (parsestr() in ast.c)
> doesn't.

FWIW, it wasn't designed this way so as to be easy to implement. It
was designed this way because the overwhelming use case is regular
expressions, where one needs to be able to escape single and double
quotes -- the re module unescapes \" and \' when it encounters them.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list