[Python-checkins] peps: PEP 8 section on string quotes by Akira Li.

guido.van.rossum python-checkins at python.org
Sun Nov 30 04:01:32 CET 2014


https://hg.python.org/peps/rev/d3d6128fa91e
changeset:   5628:d3d6128fa91e
user:        Guido van Rossum <guido at python.org>
date:        Sat Nov 29 19:01:24 2014 -0800
summary:
  PEP 8 section on string quotes by Akira Li.

files:
  pep-0008.txt |  13 +++++++++++++
  1 files changed, 13 insertions(+), 0 deletions(-)


diff --git a/pep-0008.txt b/pep-0008.txt
--- a/pep-0008.txt
+++ b/pep-0008.txt
@@ -390,6 +390,19 @@
   public and internal interfaces still apply.
 
 
+String Quotes
+=============
+
+In Python, single-quoted strings and double-quoted strings are the
+same.  This PEP do not make a recommendation for this.  Pick a rule
+and stick to it.  When a string contains single or double quote
+characters, however, use the other one to avoid backslashes in the
+string.  It improves readability.
+
+For triple-quoted strings, always use double quote characters to be
+consistent with the docstring convention in PEP 257.
+
+
 Whitespace in Expressions and Statements
 ========================================
 

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list