Gah! You are overthinking it. This idea is only worth it if it's dead simple, and the version that Eric posted to start this thread, where !d uses the repr() of the expression, is the only one simple enough to bother implementing.

In that case, I have no real use for it, for reasons already explained (I rarely want the repr, and already have lots of code that tediously repeats the


pattern inside f-strings).  Even for displaying integers, where you might _assume_ I'd be happy with the repr, I'm often not:

    print(f"nballs {nballs:,} into nbins {nbins:,}")

is one I just happened to write today.  Without comma formatting, the output is much harder to read.

Note that transforming




is actually slightly more involved than transforming it into


so I don't buy the argument that the original idea is simpler.  More magical and less useful, yes ;-)