Convert to f-strings
weavage opened this issue · comments
Python f-strings were introduced in 3.6 (if i recall correctly), which officially went EOL 12-23-2021. See here. Is there any interest in converting to f-strings? It would break compatibility before 3.6, but could simplify some of the printing functions and I may have some cycles to work on it.
Hi Weavage,
Thanks for the note, but it's something that I'm keeping for a future release.
Translating all prints to f-string will brake the installation, on systems that can't keep an up to date version of Python, without adding any value to the final user.
Also, I don't see that a full usage of f-strings can fit in all cases to produce a clean code:
print(sp0 + 'System shutdowns' + sp1 + str(updown['ok']) + sp4 + 'ok' + sp7 + str(updown['bad']) + sp4 + 'bad' + sp0)
vs
print(f"{sp0}System shutdowns{sp1}{str(updown['ok'])}{sp4}ok{sp7}{str(updown['bad'])}{sp4}bad{sp0}")
a mixed approach looks better:
print(sp0 + 'System shutdowns' + f"{sp1}{str(updown['ok'])}{sp4}ok" + f"{sp7}{str(updown['bad'])}{sp4}bad" + sp0)
Gotcha. If you don't want to break compatibility it's a moot discussion. I was thinking a more programmatic or templated approach to generating the output so you wouldn't need so many of those complicated statements. Thanks for replying, feel free to close issue!