I really like Python's new f-strings. And use them everywhere I can. Including my latest program note to self (will be referred as NTS from now on).
The only "bad" thing about f-strings is that they kinda came "too late". Only appearing from Python 3.6 onwards. For most stuff, this is fine as you have virtualenvs and stuff like that. But NTS is a command line program, which might use the system Python version. And the system python might not be that new. (Ubuntu 18.04 still uses 3.5 according to this issue)
So, let's see if we can have both.
First thing I did was to Google
python 3.5 f-strings. Leading to a Reddit post
and to this comment in particular.
So I created that function, converted all uses to f-strings to use the f function and...
It only sorta worked. It worked with stuff like the help string, but note listing errored out about an imported variable. Ok, let's see what we can do.
In the same post, at the very bottom, I saw this. And it's exactly what we did, except it uses some Formatter magic.
Put that in the place of our function, and everything works without any issues!