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

Raymond Hettinger python at rcn.com
Wed Sep 30 19:05:05 CEST 2009


[Terry Reedy]

However it is done, I think someone (like new Python programmers) should be able to program in Python3, and use everything in the stdlib, without ever learning % formatting -- and that I should be able to forget about it ;-).

+10 on the goal.

If that were possible, it would be nice. But as long as the language supports %-formatting, it is going to be around in one form or another. Any non-casual user will bump into %-formatting in books, in third-party modules, in ASPN recipes, on the newsgroup, and in our own source code. If they maintain any exising software, they will likely encounter too. It doesn't seem to be a subject that can be ignored.

Also, I think it premature to say that {}-formatting has been proven in battle. AFAICT, there has been very little uptake. I've personally made an effort to use {}-formatting more often but find that I frequently have to lookup the syntax and need to experiment with the interactive interpreter to get it right. I haven't found it easy to teach or to get other people to convert. This is especially true if the person has encountered %-formatting in other languages (it is a popular approach).

Raymond



More information about the Python-Dev mailing list