Thanks to David Beazley\'s tweet, I\'ve recently found out that the new Python 3.6 f-strings can also be nested:
>>> price = 478.23
>>> f\"
Any basic use case is where you need a string to completely describe the object you want to put inside the f-string braces {}. For example, you need strings to index dictionaries.
So, I ended up using it in an ML project with code like:
scores = dict()
scores[f'{task}_accuracy'] = 100. * n_valid / n_total
print(f'{task}_accuracy: {scores[f"{task}_accuracy"]}')