
I'll do what I can to sway you.
Guido, please....pretty please with sugar on top (hehehe). I've been spoiled with languages which do better raw string. I designed Slick-C which I've been using for years and it does not have this problem. I always type Windows paths using the Slick-C equivalent of raw strings. My implementation came from REXX (I'm no spring chicken- I think you've heard of it too :-). Now that C# has gone with this implementation,
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. Clark -----Original Message----- From: gvanrossum@gmail.com [mailto:gvanrossum@gmail.com] On Behalf Of Guido van Rossum Sent: Monday, October 01, 2007 4:40 PM To: Clark Maurer Cc: Python-Ideas Subject: Re: [Python-ideas] raw strings (Clark: I don't want to discuss this offline. On the list it goes.) Quote doubling isn't a viable option for Python -- I don't believe it's sane to have both backslashes and quote-double as escape mechanisms. Of course in C# the trailing \ is the main use case -- after all it's a Microsoft product. While for some Windows users this may be a nuisance, I don't think they are in the majority amongst Python users. --Guido On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote: that
pretty much makes it the modern way to do this. C# has a lot more clout than Slick-C. Yes, these style strings are intended for regexes AND Windows paths. Just think, you can get rid of one FAQ. It's easier to document. The down side is that there will be some backward compatibility issues. I will admit, compared to other issues this is a small one.
Trailing backslash isn't the only problem but it's the bigger one. Two quotes should be one single quote. Otherwise, specifying both quote characters in regexes is an issue. Yes, I've done this in regular expressions. This change could cause some backward compatibility problems as well.
Clark -----Original Message----- From: python-ideas-bounces@python.org [mailto:python-ideas-bounces@python.org] On Behalf Of Guido van Rossum Sent: Monday, October 01, 2007 3:54 PM To: Steven Bethard Cc: Python-Ideas Subject: Re: [Python-ideas] raw strings
On 10/1/07, Steven Bethard <steven.bethard@gmail.com> wrote:
On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote:
The current implementation doesn't allow for a trailing backslash in the string.
I believe that will change in Python 3.0.
The discussion is here:
http://mail.python.org/pipermail/python-3000/2007-May/007684.html
And Ron Adam's current patch is here: http://bugs.python.org/issue1720390
On 10/1/07, Guido van Rossum <guido@python.org> wrote:
I'm still against actually. That's why the patch hasn't been applied yet.
Sorry, my mistake. I read the thread as being somewhat in support of
On 10/1/07, Steven Bethard <steven.bethard@gmail.com> wrote: the change.
I admit I've been wobbling a lot on this.
Anyway, to the OP, if you want to make this happen, you should help Ron out with his patch. (Code has a much better chance of convincing Guido than anything else does.)
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.
-- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (home page: http://www.python.org/~guido/)