Skip to content

Commit

Permalink
Add string quote type recommendation to style guide
Browse files Browse the repository at this point in the history
  • Loading branch information
lukpueh committed Dec 1, 2020
1 parent 1ed388a commit 6837167
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ version control system can provide that information just as well.
*[cf. Google Python Style Guide
[Strings](https://google.github.io/styleguide/pyguide.html#310-strings)]*

#### Quotes
Favor double quotes `"` over single quotes `'` for regular strings, unless the
string itself contains double quotes. If the string contains both single and
double quotes, pick whatever requires less escaping inside the string.

#### String Formatting
Use `f"...{var}"` when writing Python 3.6+ code, or `"...{0}".format(var)`
anywhere. `"..." + var` may be used for simple cases, but beware of pitfalls
such as easily missed whitespace, or `var` not being a string. Don't use the
Expand Down

0 comments on commit 6837167

Please sign in to comment.