Py-dea: Streamline string literals now!

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Dec 28 01:58:37 EST 2011


On Tue, 27 Dec 2011 21:34:19 -0800, Rick Johnson wrote:

> Now. If anyone can look at that mess and not admit it is a disaster,
> well then...

It isn't a disaster. A disaster is when people die, lose their houses, 
get tossed out into the street to starve, radioactive contamination 
everywhere, floods, fire, the first born of every family being struck 
down suddenly, that sort of thing. Not having eight ways to write string 
literals. That's merely a convenience.


> 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?


-- 
Steven



More information about the Python-list mailing list