Coding Style: Quotes

Bradley D. Larson blarson at
Thu Sep 12 12:08:26 EDT 2002

Since most SQL statements utilize single quotes to designate 'strings' I have gone
pretty much to double on the outside and single on the inside.

          sql = "update mytable set firstname = 'Brad' where idx = 1;"
          execute (sql)

 Otherwise the decision is pretty much arbitrary.

Michael Stenner wrote:

> On Thu, Sep 12, 2002 at 02:25:11PM +0000, 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.
> Since there is no "physical" difference between them, I can't imagine
> why it would matter.  The only reason there "needs" to be two is for
> nested quoting.  Sure, it would be annoying to alternate for each
> string, but beyond that...
> Personally, my use tends to be c/perl influenced.  I use single quotes
> for short static things and double quotes for longer things and format
> strings.
> f['key'] = "This is a long string, but it's just _my_ style..."
>                                         -Michael
> --
>   Michael Stenner                       Office Phone: 919-660-2513
>   Duke University, Dept. of Physics       mstenner at
>   Box 90305, Durham N.C. 27708-0305
> --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blarson.vcf
Type: text/x-vcard
Size: 400 bytes
Desc: Card for Bradley D. Larson
URL: <>

More information about the Python-list mailing list