Skip to content

Commit 6837167

Browse files
committed
Add string quote type recommendation to style guide
1 parent 1ed388a commit 6837167

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ version control system can provide that information just as well.
157157
*[cf. Google Python Style Guide
158158
[Strings](https://google.github.io/styleguide/pyguide.html#310-strings)]*
159159

160+
#### Quotes
161+
Favor double quotes `"` over single quotes `'` for regular strings, unless the
162+
string itself contains double quotes. If the string contains both single and
163+
double quotes, pick whatever requires less escaping inside the string.
164+
165+
#### String Formatting
160166
Use `f"...{var}"` when writing Python 3.6+ code, or `"...{0}".format(var)`
161167
anywhere. `"..." + var` may be used for simple cases, but beware of pitfalls
162168
such as easily missed whitespace, or `var` not being a string. Don't use the

0 commit comments

Comments
 (0)