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:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido van Rossum schrieb:
But why upset them? What is the reason for not allowing trailing backslashes in raw strings, except more code in the tokenizer? Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.

On 10/1/07, Georg Brandl <g.brandl@gmx.net> wrote:
Well, everybody else who is tokenizing Python will also have to have more code. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

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
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote:
Quote doubling is only for the quote you started the raw string with.
Understood.
Even python does this, with %% on format strings -- but it is only natural to someone who already has some experience programming. -jJ

On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote:
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/)

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 personal. -----Original Message----- From: gvanrossum@gmail.com [mailto:gvanrossum@gmail.com] On Behalf Of Guido van Rossum Sent: Monday, October 01, 2007 5:30 PM To: Clark Maurer Cc: python-ideas@python.org Subject: Re: [Python-ideas] raw strings On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote:
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/)

Clark Maurer wrote:
Quote-doubling is a mechanism which should be used ONLY for raw strings.
But there would be two quoting mechanisms in the *language*, and you would have to remember which type of string used which.
This would be consistent with C#, REXX, and Slick-C. It's very natural to me.
But *un*-natural to anyone not familiar with those languages, and confusing to anyone expecting consistency between one kind of string and another within the same language. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing@canterbury.ac.nz +--------------------------------------+

Guido van Rossum schrieb:
But why upset them? What is the reason for not allowing trailing backslashes in raw strings, except more code in the tokenizer? Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.

On 10/1/07, Georg Brandl <g.brandl@gmx.net> wrote:
Well, everybody else who is tokenizing Python will also have to have more code. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

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
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote:
Quote doubling is only for the quote you started the raw string with.
Understood.
Even python does this, with %% on format strings -- but it is only natural to someone who already has some experience programming. -jJ

On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote:
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/)

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 personal. -----Original Message----- From: gvanrossum@gmail.com [mailto:gvanrossum@gmail.com] On Behalf Of Guido van Rossum Sent: Monday, October 01, 2007 5:30 PM To: Clark Maurer Cc: python-ideas@python.org Subject: Re: [Python-ideas] raw strings On 10/1/07, Clark Maurer <cmaurer@slickedit.com> wrote:
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/)

Clark Maurer wrote:
Quote-doubling is a mechanism which should be used ONLY for raw strings.
But there would be two quoting mechanisms in the *language*, and you would have to remember which type of string used which.
This would be consistent with C#, REXX, and Slick-C. It's very natural to me.
But *un*-natural to anyone not familiar with those languages, and confusing to anyone expecting consistency between one kind of string and another within the same language. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing@canterbury.ac.nz +--------------------------------------+
participants (6)
-
Clark Maurer
-
Georg Brandl
-
Greg Ewing
-
Guido van Rossum
-
Jim Jewett
-
Ron Adam