Python Gotcha's?

rusi rustompmody at gmail.com
Fri Apr 6 11:43:55 EDT 2012


On Apr 6, 8:40 pm, André Malo <ndpar... at gmail.com> wrote:
> * Steven D'Aprano wrote:
> > 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.
>
> Yes, that's what you said already. My reasoning was in the part you stripped
> from my quote. *shrug*

Multiple symmetric quote characters breaks one of python's own zen
rules:

There should be one-- and preferably only one --obvious way to do it.



More information about the Python-list mailing list