Coding Style: Quotes

Erik Max Francis max at
Thu Sep 12 16:16:27 EDT 2002

John Waycott wrote:

> I'm curious if others have adopted any standards for choice of single
> vs.
> double quotation marks to delimit strings. A look through the standard
> library reveals the choice of one over the other is rather arbitrary.
> I
> suspect it really makes no difference, but the question has come up
> during a
> code review.

It really makes no difference (provided similar quotes are escaped in
the string), so it comes down to a simple matter of style.  I personally
tend to use single quotes for simple keywords, the equivalent of
identifiers, or non-English data (such as HTML or XML fragments), and
double quotes for English phrases or text.

 Erik Max Francis / max at /
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ The revolution will not televised
\__/ Public Enemy
    Blackgirl International /
 The Internet resource for black women.

More information about the Python-list mailing list