.format vs. %

Andrew Berg bahamutzero8825 at gmail.com
Tue Jan 3 05:55:16 EST 2012

On 1/2/2012 11:58 PM, Ian Kelly wrote:
> I can't believe I'm taking Rick's side here, but the docs do say:
> "Note: The formatting operations described here are obsolete and may
> go away in future versions of Python. Use the new String Formatting in
> new code."
> http://docs.python.org/py3k/library/stdtypes.html#old-string-formatting-operations
And that is mainly what I based my statement on. As I said, it's not
likely to be any time soon. I highly doubt it will even become
deprecated in 3.3, but it wouldn't surprise me if it becomes deprecated
in 3.4 and removed in 4.0. In any case, I should've said "will probably
go away".

To add my opinion on it, I find format() much more readable and easier
to understand (with the exception of the {} {} {} {} syntax), and would
love to see %-style formatting phased out.

CPython 3.2.2 | Windows NT 6.1.7601.17640

More information about the Python-list mailing list