RFC PEP candidate: q'<delim>'quoted<delim> ?
jeff at ccvcorp.com
Tue Mar 5 21:00:56 CET 2002
Bengt Richter wrote:
> >Making Python as gibberish as Perl is. And all that only to
> >have Windows path be written without double-\
> Not 'only'. I said 'also' ;-) Perhaps my choice of '|' delimiter triggered
> your 'gibberish as Perl' detector?
> I could have written
> q'[quoting delimiter]'c:\foo\bar\[quoting delimiter]
> just as well for this one.
I still don't like it. It's very difficult for me to see at a glance, what's part of
the string and what is part of the delimiter, especially with the leading delimiter
being quoted and the trailing one not quoted. It looks unbalanced, it looks ungainly,
and, to me, it just plain looks ugly. I'd expect the above example to be equivalent to
"'c:\\foo\\bar\\", with a leading mismatched single-quote... Your earlier example of
cutting & pasting left me totally confused until I spent a minute sorting through it.
At least to me, this seems totally unclear and totally nonintuitive. It vastly
multiplies the possibilities for writing hard-to-read code, while providing a real
benefit in relatively few situations. Considering how often triple-quotes appear in
text files, I can only imagine this being needed when trying to programmatically
generate Python code, which doesn't seem to be a terribly common task. I'd prefer to
find an alternate solution for the specific case of that task, which doesn't require
changing the core language and creating so much potential for ugly code in every other
task that can be done with Python.
More information about the Python-list