[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Use f-strings in python scripts
From: |
Markus Armbruster |
Subject: |
Re: [PATCH] Use f-strings in python scripts |
Date: |
Thu, 16 Mar 2023 07:07:21 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
John Snow <jsnow@redhat.com> writes:
[...]
> Until then, docstrings should use triple-double quotes. Any other
> string can use whatever quoting style happens to be most convenient
> for the string being written to minimize escaping. Consistency is nice
> where reasonable, but minimizing escapes by using different styles on
> an as-needed basis is a respectable and good thing.
>
> I glanced *very quickly* at these files and it looks like the style is
> to use double quotes for format strings and single quotes for constant
> strings. That seems fine to me.
I agree, and so does PEP 8:
String Quotes
In Python, single-quoted strings and double-quoted strings are the
same. This PEP does 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.
[...]