[Python-Dev] summary of transitioning from % to {} formatting
R. David Murray
rdmurray at bitdance.com
Sat Oct 3 18:19:32 CEST 2009
More information about the Python-Dev mailing list
Sat Oct 3 18:19:32 CEST 2009
- Previous message: [Python-Dev] summary of transitioning from % to {} formatting
- Next message: [Python-Dev] summary of transitioning from % to {} formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 3 Oct 2009 at 17:08, Paul Moore wrote: > 2009/10/3 Antoine Pitrou <solipsis at pitrou.net>: >> Steven Bethard <steven.bethard <at> gmail.com> writes: >>> >>> If %-formatting is to be deprecated, the transition strategy here >>> is trivial. However, no one has yet written translators, and it is >>> not clear what heuristics should be used, e.g. should the method >>> just try %-formatting first and then {}-formatting if it fails? >> >> This would be a reasonable heuristic. It should be done only on the first call, >> though, and then the result remembered (for both performance reasons and >> consistency). >> >> The cases where a format string would function in both formatting styles and >> expect the same parameters must be very rare in the real world. > > Define "fails": > >>>> "{a} {b} c" % {'a':12} > '{a} {b} c' > > That didn't fail... Also, what if both fail? Which failure's error message gets printed? --David (RDM)
- Previous message: [Python-Dev] summary of transitioning from % to {} formatting
- Next message: [Python-Dev] summary of transitioning from % to {} formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list