[Python-Dev] transitioning from % to {} formatting

Raymond Hettinger python at rcn.com
Thu Oct 8 19:14:19 CEST 2009


[Christian Tanzer]
>> How do you suppose that maintainers could ever do the transition from
>> %- to {}-formatting manually?

[Guido van Rossum]
> This is pretty much the situation with integer division (you can only
> recognize it by running the code),

Do you think there may be some possible parallel to the -3 option
to flag cases of %-formatting?  If so, that could be helpful.



> So, yes, we will continue to make noise about this. And yes you should
> opportunistically migrate your code to {}-formatting, like when you're
> rewriting some code anyway. One of the nice things about {}-formatting
> is that in most cases (things like the logging API excluded) you can
> change it one format string at a time.

I've already have some code that mixes the styles (using {} for new stuff).


Raymond


More information about the Python-Dev mailing list