[Python-Dev] transitioning from % to {} formatting (original) (raw)
Benjamin Peterson benjamin at python.org
Mon Oct 5 03:54:34 CEST 2009
- Previous message: [Python-Dev] transitioning from % to {} formatting
- Next message: [Python-Dev] transitioning from % to {} formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2009/10/4 INADA Naoki <songofacandy at gmail.com>:
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 "formatstring" in future. n+1: deprecate mod() without 'F'. n+2: libraries use .format() and deprecate mod() with 'F' n+3: remove mod()
-1 That requires keeping formatting information around in every string instance.
-- Regards, Benjamin
- Previous message: [Python-Dev] transitioning from % to {} formatting
- Next message: [Python-Dev] transitioning from % to {} formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]