Skip to content

Commit

Permalink
Clarify single-quotes rule in Python coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Nov 25, 2012
1 parent 1625ecf commit 77f8224
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions doc/python-coding-standards.rst
Expand Up @@ -23,8 +23,16 @@ avoid spurious merge conflicts, and aid in reading pull requests.
Use Single Quotes
-----------------

Use the single-quote character, ``'``, rather than the double-quote character,
``"``, for string literals.
Use single-quotes for string literals, e.g. ``'my-identifier'``, *but* use
double-quotes for strings that are likely to contain single-quote characters as
part of the string itself (such as error messages, or any strings containing
natural language), e.g. ``"You've got an error!"``.

Single-quotes are easier to read and to type, but if a string contains
single-quote characters then double-quotes are better than escaping the
single-quote characters or wrapping the string in double single-quotes.

We also use triple single-quotes for docstrings, see `Docstrings`_.


Imports
Expand Down

0 comments on commit 77f8224

Please sign in to comment.