sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Use f-strings where possible

Open AA-Turner opened this issue 1 year ago • 3 comments
trafficstars

AA-Turner avatar Apr 29 '24 00:04 AA-Turner

Sorry but I am very -1 against this, I don't think you should be enforcing ad-hoc formatting rules, that touch nearly every file of the project, whilst blocking an actual formatter (https://github.com/sphinx-doc/sphinx/pull/12335#issuecomment-2081716393)

I assume you used some form of automated formatter to actually create this PR? why not add it to the formatters?

chrisjsewell avatar Apr 29 '24 01:04 chrisjsewell

I assume you used some form of automated formatter to actually create this PR? why not add it to the formatters?

We already enable the UP031 and UP032 codes -- this work was me going through manually for the cases that those rules don't capture, for whatever reason.

The idea behind this was the (small) performance improvements that f-strings yield over percent-formatting, rather than style, but nevertheless I'm happy to close and revisit this later if you'd prefer.

A

AA-Turner avatar Apr 29 '24 01:04 AA-Turner

but nevertheless I'm happy to close and revisit this later if you'd prefer.

thanks for explaining; I'm mean, the irony is that I am definitely in favor of this kind of change, I just feel if we are anyway making such a "pervasive" change to the code-base, let's add the formatter.

But look, if you want to merge, I won't block, because life's too short for disagreements over these more trivial things 😄

chrisjsewell avatar Apr 29 '24 02:04 chrisjsewell