Hi SciPy-dev, On reviewing this pr: https://github.com/scipy/scipy/pull/12376 cool-RR was asking about whether f strings are ok in scipy now. I wasn’t sure and couldn’t find any, nor clear documentation on a preferred format. I know different (parts) of different sub packages may use ‘%’ for interpolation and others use .format() I poked around trying to find examples in codebase but GitHub searching for f” didn’t give anything, nor did I find anything in the hacking file or related links. Do we have a preferred string interpolation method for SciPy? Note the discussion of the string interpolation is about a potential follow up PR that cool-RR may do and not the Linked PR itself. Sincerely, -Lucas Roberts
On 7/3/20, rlucas7@vt.edu <rlucas7@vt.edu> wrote:
Hi SciPy-dev,
On reviewing this pr:
https://github.com/scipy/scipy/pull/12376
cool-RR was asking about whether f strings are ok in scipy now. I wasn’t sure and couldn’t find any, nor clear documentation on a preferred format.
Yes, f-strings are acceptable now. But I don't think we want to go back and convert all uses of .format() and '%' to f-strings. The benefit is probably not worth the code churn. So for now, it is probably best to use f-strings in new code, and when updating old code for some other reason. E.g. if some additional information is added to the message of exception, and the old code uses '%', it would be fine to change it to use an f-string. Other devs may have different opinions about that, so let's see what others say before that is considered official policy. Warren
I know different (parts) of different sub packages may use ‘%’ for interpolation and others use .format()
I poked around trying to find examples in codebase but GitHub searching for f” didn’t give anything, nor did I find anything in the hacking file or related links.
Do we have a preferred string interpolation method for SciPy?
Note the discussion of the string interpolation is about a potential follow up PR that cool-RR may do and not the Linked PR itself.
Sincerely,
-Lucas Roberts
We could start using git's blame.ignoreRevsFile, which would hide the code churn*. *only on the client side until github supports this feature. If you want to push github to add this feature, reference this gitlab issue: https://gitlab.com/gitlab-org/gitlab/-/issues/31423 see: https://github.com/ipython/ipython/pull/12091/files -Terry On Fri, Jul 3, 2020 at 12:40 PM Warren Weckesser <warren.weckesser@gmail.com> wrote:
Hi SciPy-dev,
On reviewing this pr:
https://github.com/scipy/scipy/pull/12376
cool-RR was asking about whether f strings are ok in scipy now. I wasn’t sure and couldn’t find any, nor clear documentation on a preferred
On 7/3/20, rlucas7@vt.edu <rlucas7@vt.edu> wrote: format.
Yes, f-strings are acceptable now.
But I don't think we want to go back and convert all uses of .format() and '%' to f-strings. The benefit is probably not worth the code churn. So for now, it is probably best to use f-strings in new code, and when updating old code for some other reason. E.g. if some additional information is added to the message of exception, and the old code uses '%', it would be fine to change it to use an f-string.
Other devs may have different opinions about that, so let's see what others say before that is considered official policy.
Warren
I know different (parts) of different sub packages may use ‘%’ for interpolation and others use .format()
I poked around trying to find examples in codebase but GitHub searching
for
f” didn’t give anything, nor did I find anything in the hacking file or related links.
Do we have a preferred string interpolation method for SciPy?
Note the discussion of the string interpolation is about a potential follow up PR that cool-RR may do and not the Linked PR itself.
Sincerely,
-Lucas Roberts
SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
On Fri, Jul 3, 2020 at 9:40 PM Warren Weckesser <warren.weckesser@gmail.com> wrote:
Hi SciPy-dev,
On reviewing this pr:
https://github.com/scipy/scipy/pull/12376
cool-RR was asking about whether f strings are ok in scipy now. I wasn’t sure and couldn’t find any, nor clear documentation on a preferred
On 7/3/20, rlucas7@vt.edu <rlucas7@vt.edu> wrote: format.
Yes, f-strings are acceptable now.
But I don't think we want to go back and convert all uses of .format() and '%' to f-strings. The benefit is probably not worth the code churn. So for now, it is probably best to use f-strings in new code, and when updating old code for some other reason. E.g. if some additional information is added to the message of exception, and the old code uses '%', it would be fine to change it to use an f-string.
Other devs may have different opinions about that, so let's see what others say before that is considered official policy.
+1 completely agree Ralf
Warren
I know different (parts) of different sub packages may use ‘%’ for interpolation and others use .format()
I poked around trying to find examples in codebase but GitHub searching
for
f” didn’t give anything, nor did I find anything in the hacking file or related links.
Do we have a preferred string interpolation method for SciPy?
Note the discussion of the string interpolation is about a potential follow up PR that cool-RR may do and not the Linked PR itself.
Sincerely,
-Lucas Roberts
SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
participants (4)
-
Ralf Gommers -
rlucas7@vt.edu -
Terry -
Warren Weckesser