Coding Style: Quotes

Michael Stenner mstenner at phy.duke.edu
Fri Sep 13 16:46:12 EDT 2002


On Fri, Sep 13, 2002 at 10:05:45PM +0200, Thorsten Kampe wrote:
> * John Waycott
> > 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.
> 
> Python itself seems to "prefer" single quotes slightly:
> 1: >>> "String"
> 1:     'String'
> 2: >>>

I hate to be so picky, but it _is_ after all, my nature... :)

Just because it uses the single quote doesn't mean it prefers it.  It
(or the authors, rather) had to choose.  They couldn't just not pick
one.  Also, the method you use to input the string IS NOT part of the
string, and so should be dropped after it's role (encoding the string)
is complete.  Therefore, your example does not support your statement.

Of course, I suspect it is for just this reason that you quoted
"prefer". :)
					-Michael
-- 
  Michael Stenner                       Office Phone: 919-660-2513
  Duke University, Dept. of Physics       mstenner at phy.duke.edu
  Box 90305, Durham N.C. 27708-0305




More information about the Python-list mailing list