Mandis Quotes (aka retiring """ and ''')
Jeff Shannon
jeff at ccvcorp.com
Tue Oct 5 14:49:28 EDT 2004
Russell Nelson wrote:
>It really would be better to have one(1) string literal
>which can quote anything without reverting to backslashing. Why one?
>Simpler parsing, simpler learning of the language, fewer choices to
>make while programming.
>
>
The problem being, of course, that you need to find a string literal
that will *never*, *ever* appear inside of a string literal. Even in
strings that contain language describing the quoting of string
literals. If there's any possibility of the need to display that
particular string literal, then you need to either have an alternate
(and what if you need both alternates in a string? then you need a third
alternate...) or you need to have a way of escaping it. ISTM that these
elaborate Mandis-quote schemes may significantly reduce the odds of
needing to escape a string literal, but the cost (in clarity,
transparency, and most importantly, ability to manipulate your code in
anything other than an advanced, complying editor) is pretty high. I
find '''triple quotes''' a lot easier to understand/explain than this
scheme of defining arbitrary delimiters.
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list