[Python-ideas] raw strings
cmaurer at slickedit.com
Tue Oct 2 00:06:13 CEST 2007
It sounds like nobody likes quote-doubling. Supporting a trailing
backslash would alleviate the need for an FAQ item and the typical
confusion. Sounds like most agree on that point. Sorry about sounding
From: gvanrossum at gmail.com [mailto:gvanrossum at gmail.com] On Behalf Of
Guido van Rossum
Sent: Monday, October 01, 2007 5:30 PM
To: Clark Maurer
Cc: python-ideas at python.org
Subject: Re: [Python-ideas] raw strings
On 10/1/07, Clark Maurer <cmaurer at slickedit.com> wrote:
> Guido, I'm not proposing both escape mechanisms. Quote-doubling is a
> mechanism which should be used ONLY for raw strings. Let be very
> specific how this is done:
> r"Here's a string with a single quote"
> r'"Heres a double quoted string"'
> r'["'']' # This regex has both quotes in it
> r"[""']" # This regex has both quotes in it
> Quote doubling is only for the quote you started the raw string with.
> This would be consistent with C#, REXX, and Slick-C. It sounds like
> you've never used a language with this construct. It's very natural to
> me. This would make the raw strings implementation complete.
As long as we're making personal comments, who cares about REXX or
Slick-C? How many users do they have? And yes, I've used this for
years in Pascal, so I'm well familiar with it. The whole problem is
that when using regexes you *do* have to deal with both escape
mechanisms (one for the string literal tokenization and one for the re
module). And that's unacceptable for me.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-ideas