[Python-Dev] %-formatting depracation

Xavier Morel python-dev at masklinn.net
Wed Feb 23 14:03:08 CET 2011


On 2011-02-23, at 12:30 , Hrvoje Niksic wrote:
> On 02/22/2011 11:03 PM, Antoine Pitrou wrote:
>> I think there are many people still finding %-style more practical for
>> simple uses,
> 
> It's also a clash of cultures. People coming from a C/Unix background typically find %-style format obvious and self-explanatory, while people coming from Java/DotNET background feel the same way about {}-style formats.
For Java it's debatable: the Java 5 string formatting APIs are all printf-style (java.io.PrintStream#printf[0], String#format[1], java.util.Formatter[2]).

The older java.text.MessageFormat[3] (still used a lot for property lists as it's built for localization among other things) does use {}-style, though one quite different than Python's.

[0] http://download.oracle.com/javase/1.5.0/docs/api/java/io/PrintStream.html#printf(java.lang.String,%20java.lang.Object...)
[1] http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#format(java.lang.String,%20java.lang.Object…)
[2] http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html
[3] http://download.oracle.com/javase/1.5.0/docs/api/java/text/MessageFormat.html


More information about the Python-Dev mailing list