News for hackers. Stuff that matters.
Re:Python 3's F-Strings: An Improved String Formatting Syntax by shakna on Wednesday January 20, 2021 @10:36PM (#25855072)
Whilst percent strings can't, calls to format can.

So:

    log.debug("Unexpected, got {got}".format(got=got))
Or, to just use the available locals to automatically fill that in for you:

    log.debug("Unexepected, got {got}".format(**locals()))
Or if you want both globals and locals with a preference for locals:

    log.debug("Unexepected, got {got}".format(**{**globals(), **locals()}))
Re:Python 3's F-Strings: An Improved String Formatting Syntax by jon_richards on Thursday January 21, 2021 @10:44AM (#25860038)
Yes, I was asked by a Junior if they should always use f strings now. There are still a couple situations where you need format, such as when you’re formatting a variable instead of a literal.

Also, shoutout to Template for untrusted strings. It’s surprisingly unknown. Most people suggest replace or a custom format function.