[Python-ideas] raw strings

Steven Bethard steven.bethard at gmail.com
Mon Oct 1 22:56:45 CEST 2007

On 10/1/07, Tal Einat <taleinat at gmail.com> wrote:
> On 10/1/07, Guido van Rossum <guido at python.org> wrote:
> > Not in this case. It's more the philosophical distinction -- are raw
> > strings meant primarily to hold regexes or Windows pathnames? These
> > two use cases have opposite requirements for trailing backslash
> > treatment. I know the original use case that caused them to be added
> > to the language is regexes, and that's still the only one I use on a
> > regular basis.
> >
> >From a teaching (and simplicity) viewpoint, having these be "raw
> strings" instead of "regexp strings" would be better. The current
> behavior is a snag I always have to mention when teaching Python, and
> students are often caught by this once or twice.
> As for my experience with regexps, the current behavior is only useful
> when using both single and double quotes in a single regexp string; I
> can't recall when I last did so.

I think this is the crux of the matter.  It's not really about
comparing use of regular expressions with use of Windows paths.  It's
about comparing use of regular expressions *that include both types of
quotes* and use of Windows paths.  Of course, I don't really know how
to perform this sort of comparison on a large scale either. ;-)

> From the teaching point of view, the preferred behavior for "raw
> strings" would be no escaping for quotes - make them escape-less,
> period.

Exactly my feeling.  Thanks for putting it so clearly. =)

I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy

More information about the Python-ideas mailing list