[Python-ideas] raw strings

Jim Jewett jimjjewett at gmail.com
Mon Oct 1 23:22:33 CEST 2007


On 10/1/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 10/1/07, Tal Einat <taleinat at gmail.com> wrote:

> > 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 have seen regular expressions that look for a double-quoted string
which might contain an apostrophe, but don't remember writing one.
Other than that, I can't remember *ever* needing to unless I was
really (at some level) saying  "either of these two"; I also can't
remember doing it without being annoyed at having to figure out how
many ticks were there, and whether it was double-single or three
singles, or what.

For me, usability and readability would both improve by offering a
named special character, such as \q.

> > 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. =)

Agreed.  And also from a "what do *I* have to remember", or a "how
does this interact when it gets passed to something else" perspective,
because it would remove one level of escaping.

-jJ



More information about the Python-ideas mailing list