[Python-Dev] Tool for converting %-formatting to .format()ing ?
M.-A. Lemburg
mal at egenix.com
Sat May 10 15:24:42 CEST 2008
On 2008-05-10 01:18, Martin v. Löwis wrote:
>> Is there a tool available that can convert 2.x code automagically
>> to the .format() method syntax ?
>>
>> Just did a quick grep of our code base and it has some 2000 lines of code
>> that would need to be changed.
>
> Why do you think this code needs to change?
>
> I'd leave all the code as-is, and might not start using .format before
> Python 3.2, unless some coding convention says I have to.
True, just wanted to know whether there is such a tool.
I personally like the %-notation a lot, mainly because it's more
or less the same as in C.
%i, %s and %r are by far the most used format characters in our code base.
Determining the position index and writing {0!s} or {0!r} instead
(which requires quite a finger dance on a German keyboard) doesn't
make .format() really attractive, IMHO.
Perhaps you're right and it's better to wait a few rounds of
refinements of .format() before jumping on that train :-)
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, May 10 2008)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-Dev
mailing list