From a4e187da6bab4d835363e0e2c0172ef69b104ef3 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 29 Nov 2014 19:01:24 -0800 Subject: [PATCH 1/2] PEP 8 section on string quotes by Akira Li. --- pep-0008.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pep-0008.txt b/pep-0008.txt index acb6f5998..a3c6f1f51 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -390,6 +390,19 @@ Imports 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 ======================================== From 9287cc8ab5257a24a90859c0048bfca3e312875c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 29 Nov 2014 19:02:36 -0800 Subject: [PATCH 2/2] Last patch was by Akira Kitada, not Akira Li. --- pep-0008.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pep-0008.txt b/pep-0008.txt index a3c6f1f51..6df365632 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -397,7 +397,7 @@ 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. +string. It improves readability. For triple-quoted strings, always use double quote characters to be consistent with the docstring convention in PEP 257.