[Python-Dev] transitioning from % to {} formatting (original) (raw)

INADA Naoki songofacandy at gmail.com
Mon Oct 5 03:52:31 CEST 2009


What about using string prefix 'f'?

f"{foo} and {bar}" % something == "{foo} and {bar}.format(something)

s = f"{foo}" t = "%(bar)s" s + t # raises Exception

Transition plan: n: Just add F prefix. And adding "format_string" in future. n+1: deprecate mod() without 'F'. n+2: libraries use .format() and deprecate mod() with 'F' n+3: remove mod()

-- Naoki INADA <songofacandy at gmail.com>



More information about the Python-Dev mailing list