What is prefered: 'string' or "string"? (Should be in PEP8 ?)

Andrew Dalke dalke at dalkescientific.com
Tue Apr 23 15:56:36 EDT 2002


Petr Prikryl:
>Being quite new to Python -- is there any preference of
>single or double quotes when writing strings?

In addition to the comments made by others, I tend to use
double quotes because they are more visible -- easier to spot.
Single quotes are harder to make out.

The counter example is for small strings.  In that case, 'a'
seems esthetically nicer than "a" because they don't dominate
the string.  It's also conviently similar to C's usage.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list