Python Gotcha's?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Apr 5 21:03:45 EDT 2012


On Thu, 05 Apr 2012 23:08:11 +0200, André Malo 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. 

KISS is a reason *for* allowing multiple string delimiters, not against 
it. The simplicity which matters here are:

* the user doesn't need to memorise which delimiter is allowed, and 
  which is forbidden, which will be different from probably 50% of 
  the other languages he knows;

* the user can avoid the plague of escaping quotes inside strings
  whenever he needs to embed the delimiter inside a string literal.

This is the 21st century, not 1960, and if the language designer is 
worried about the trivially small extra effort of parsing ' as well as " 
then he's almost certainly putting his efforts in the wrong place.



-- 
Steven



More information about the Python-list mailing list