Mandis Quotes (aka retiring """ and ''')

exarkun at divmod.com exarkun at divmod.com
Mon Oct 4 11:07:17 EDT 2004


On 4 Oct 2004 07:45:54 -0700, nelson at crynwr.com (Russell Nelson) wrote:
> [snip]
> Obviously, the justification for it is that it eliminates ", ', r",
> r', """, and ''' from the syntax, replacing them by a single 'x' that
> suffices for everything.  Makes the code easier to read (only one
> visual element), easier to parse, and easier to write, because you
> don't need to decide which literal method to use.
  Responding to "replacing them by a single 'x' that suffices for everything":
  No, it doesn't.
  It replaces them with an arbitrary number of string delimiters.  'x' is one, but 'y' is another, 'Would you like some spam?' is yet another.  You must still be careful in selecting your delimiter, lest you accidentally use one included in your string literal.  The chances of doing so are greatly decreased, but they are still non-zero.
  The idea doesn't seem all bad, but it doesn't seem like a great enough improvement to justify very nearly breaking every Python program ever written in dozens, hundreds, or even thousands of different places.
  Jp



More information about the Python-list mailing list