True, but they do accept function names, which can be evaluated later. Example from tstring-util · PyPI
from tstring import render
def hello(name):
print(f"hello {name}")
def test_lazy():
who = 'bob'
flavor = 'spicy'
embedx = t'Call function {hello:!fn} {who} {flavor}'
who = 'jane'
r = render(embedx)
assert r == "Call function hello jane spicy"
The key concept is a “t-string” is not so much a string as a complex object designed for an input into a library to do whatever it wants with it.
The stdlib logging library could define format specifiers to do interesting things.
Beyond the “!fn” I used for tellling render to evaluate the proceeding function name, logging could do clever things like conditionally format based on logging level.
basic = "hello"
complex = "yada yada"
msg = t"Message with {basic:info} {"and:debug"} {complex:debug}
logger.info(msg) -> Message with hello
loggin\g.deb(msg) -> Message with hello and yada yada
I’m not saying this is necessarily a good idea, merely that there are a lot of opportunities due to the open-ended nature of the format specifier.