Coding Style: Quotes

Richie Hindle richie at entrian.com
Thu Sep 12 10:58:40 EDT 2002


> I'm curious if others have adopted any standards for choice of single vs.
> double quotation marks to delimit strings.

I tend to use double-quotes for user-visible strings, and single quotes
for internal ones.  For instance:

    print "Hello, %s." % userRecord[ 'name' ]

In a library module, docstrings count as user-visible because the
"users" include the programmer using the library:

    def greetUser( userRecord ):
        """Says hello to the user."""
        print "Hello, %s." % userRecord[ 'name' ]

Don't ask me why I starting using this standard, or where the idea came
from, 'cos I have no idea.  It just seems to make sense.

-- 
Richie Hindle
richie at entrian.com




More information about the Python-list mailing list