On 12/28/2011 11:36 AM, Rick Johnson wrote:
On Dec 28, 12:58 am, Steven D'Aprano<steve
+comp.lang.pyt...@pearwood.info>  wrote:
On Tue, 27 Dec 2011 21:34:19 -0800, Rick Johnson wrote:

I am also thinking that ANY quote char is a bad choice for string
literal delimiters. Why? Well because it is often necessary to embed
single or double quotes into a string literal. We need to use a
delimiter that is not a current delimiter elsewhere in Python, and also,
is a very rare char. I believe Mr Ewing found that perfect char in his
"Multi-line uber raw string literals!" (Just scroll down a bit at this
link)...

    http://www.cosc.canterbury.ac.nz/greg.ewing/python/ideas.html

Not surprisingly, you haven't thought this through. I'm sure Greg Ewing
has, which is why he hasn't proposed *replacing* string delimiters with
his multi-line format. That's why he proposed it as a *statement* and not
string-builder syntax.

Without an end-delimiter, how do you embed string literals in expressions?

Did you even read what i wrote? And if you did, you missed the point!

My point was... while Greg's idea is nice, it is not the answer.
HOWEVER, he did find the perfect char, and that char is the pipe! -->
|

mlstr = |||
this is a
multi line sting that is
delimited by "triple pipes". Or we
could just 'single pipes' if we like, however, i think
the "triple pipe' is easier to see. Since the pipe char
is so rare in Python source, it becomes the obvious
choice. And, best of all, no more worries about
"embedded quotes". YAY!
|||

slstr = |this is a single line string|

The point is people, we should be using string delimiters that are
ANYTHING besides " and '. Stop being a sheep and use your brain!

I disagree that quotes are a bad thing. Most programming languages use +, -, / and * for arithmentic operations (* is closest character on a keyboard to x that is not the letter ex). Why do they choose to do this? It's actually a lot more work for the language implementer(s) to do this rather than simply providing functions add(x,y), subtract(x,y), divide(x,y) and multiply(x,y).

The answer is very simple - convention. We use these symbols in mathematics and so it's much more convenient to follow through the mathematical convention. The learning curve is much lower (and it's less typing). After all experienced programmers know this is what is going on under the hood in pretty much all programming languages. Compilers are just making it easy for us.

While it may indeed make sense to use a different character for delimiting strings, in English we use " to delimit spoken words in a narrative. Since strings most closely resemble spoken words from the point of view a programming language, using double quotes is a sensible choice since it eases learning.

Convention is a very strong thing to argue against (not to mention huge code breakage as a result of such a change).

Personally, I try to ensure I use consistency in the way I use the different quoting mechanisms, but that's just a personal choice. Sometimes that leads me to less pleasant looking strings, but I believe the consistency of style makes it easier to read.

I think this proposal falls in the, let's make python case-insensitive kind of idea - it's never going to happen cause it offers very little benefit at huge cost.

And I'm not going to contribute to this thread any further cause it's a pointless waste of my time to write it and others time to read it.

--
Dominic Binks: dbi...@codeaurora.org
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to