Re: [Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-10 Thread M.-A. Lemburg

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
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-09 Thread M.-A. Lemburg

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.

Thanks,
--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 09 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
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-09 Thread skip

mal Is there a tool available that can convert 2.x code automagically
mal to the .format() method syntax ?

mal Just did a quick grep of our code base and it has some 2000 lines
mal of code that would need to be changed.

I suggested a 2to3 fixer for this but was shot down.

Skip
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-09 Thread M.-A. Lemburg

On 2008-05-09 15:29, [EMAIL PROTECTED] wrote:

mal Is there a tool available that can convert 2.x code automagically
mal to the .format() method syntax ?

mal Just did a quick grep of our code base and it has some 2000 lines
mal of code that would need to be changed.

I suggested a 2to3 fixer for this but was shot down.


Well, ideally such a tool should address 2to2 :-)

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 09 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
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-09 Thread Rodrigo Bernardo Pimentel
On Fri, May 09 2008 at 10:29:17AM BRT, [EMAIL PROTECTED] wrote:
 
 mal Is there a tool available that can convert 2.x code automagically
 mal to the .format() method syntax ?
 
 mal Just did a quick grep of our code base and it has some 2000 lines
 mal of code that would need to be changed.
 
 I suggested a 2to3 fixer for this but was shot down.

I had mentioned it during the thread where it was shot down, but I have a
Google Summer of Code project (now approved and in motion - huzza!) to add
confidence ranking for 2to3 fixers. As a test for the project, I'll write a
fixer for string conversion and see if having a confidence value is enough
to make such a fixer useful.


rbp
-- 
Rodrigo Bernardo Pimentel [EMAIL PROTECTED] | GPG: 0x0DB14978
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-09 Thread Bill Janssen
 On 2008-05-09 15:29, [EMAIL PROTECTED] wrote:
  mal Is there a tool available that can convert 2.x code automagically
  mal to the .format() method syntax ?
  
  mal Just did a quick grep of our code base and it has some 2000 lines
  mal of code that would need to be changed.
  
  I suggested a 2to3 fixer for this but was shot down.
 
 Well, ideally such a tool should address 2to2 :-)

The curse of back-porting...  I, too, would find such a tool helpful;
I've got a thousand lines of %-formatting use just in UpLib alone.

Bill
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-09 Thread Martin v. Löwis
 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.

Regards,
Martin

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Tool for converting %-formatting to .format()ing ?

2008-05-09 Thread Dirk Rothe

On Fri, 09 May 2008 19:06:07 +0200, Bill Janssen [EMAIL PROTECTED] wrote:


The curse of back-porting...  I, too, would find such a tool helpful;
I've got a thousand lines of %-formatting use just in UpLib alone.


yea, I hope such a Fixer will emerge, formatting via % is just too  
painless atm in 2.5. I guess our company should check out the 'preferred'  
way to do it real soon, or else the conversion process will be really time  
consuming.


--dirk
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com