Python Gotcha's?

Cameron Simpson cs at zip.com.au
Thu Apr 5 20:15:26 EDT 2012


On 05Apr2012 23:08, André Malo <ndparker at gmail.com> wrote:
| * Steven D'Aprano wrote:
| 
| > For a 21st century programming language or data format to accept only one
| > type of quotation mark as string delimiter is rather like having a 21st
| > century automobile with a hand crank to start the engine instead of an
| > ignition. Even if there's a good reason for it (which I doubt), it's
| > still surprising.
| 
| Here's a reason: KISS. Actually I've never understood the reason for
| multiple equivalent quote characters. There are languages where these are
| not equivalent, like perl, C or shell script. There it makes way more
| sense.

I agree, except that even where the quotes are equivalent there is an
advantage: writing a string containing quotes:

  '"Hello," he said.'
  "It's funny weather."

Of course this doesn't scale much if you need both, but it covers a
common use.

Personally I'm ok with JSON accepting only one kind of quote.
And I _have_ been bitten by it and surprised in the past.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

This telephone has too many shortcomings to be seriously considered as a
means of communication. The device is inherently of no value to us.
        - Western Union memo, 1877



More information about the Python-list mailing list