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

2009-10-04 Thread Martin v. Löwis
> I agree with this 100% but I can't see it working unless we have some > sort of transition plan. Just saying "ok, switch your format strings > from % to {}" didn't work in Python 3.0 for various good reasons, and > I can't imagine it will work in Python 4.0 unless we have a transition > plan. Th

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

2009-10-04 Thread Terry Reedy
Carl Trachte wrote: I've skimmed over the PEP, and the new {}-syntax seems to have some nice features. But I've not seen it used anywhere yet. I am using it with 3.1 in an unreleased book I am still writing, and will in any code I publish. Rami Chowdhury posted this to a mailing list; I'

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

2009-10-04 Thread INADA Naoki
> -1 That requires keeping formatting information around in every string > instance. Adding new "format_string" class avoids it. unicode("foo") <=> u"foo" format_string("foo") <=> f"foo" This way's pros: * Many libraries can use one transition way. * Transition stage syncs to Python version. "l

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

2009-10-04 Thread INADA Naoki
What about using string prefix 'f'? f"{foo} and {bar}" % something == "{foo} and {bar}.format(something) s = f"{foo}" t = "%(bar)s" s + t # raises Exception Transition plan: n: Just add F prefix. And adding "format_string" in future. n+1: deprecate __mod__() without 'F'. n+2: libraries

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

2009-10-04 Thread Carl Trachte
>> Do the users get any say in this? > > I'm a user! :-) > > I hate calling methods on string literals, I think it looks very odd to > have code like this: > > "Displaying {0} of {1} revisions".format(x, y) > > Will we be able to write this as > > "Displaying {0} of {1} revisions" % (x, y) > >

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

2009-10-04 Thread Brett Cannon
On Sat, Oct 3, 2009 at 11:05, Brett Cannon wrote: > On Fri, Oct 2, 2009 at 20:03, Raymond Hettinger wrote: >> >> [Terry Reedy] >>> >>> I would agree, for instance, that an auto-translation tool is needed. >> >> We should get one written.  ISTM, every %-formatting >> string is directly translatabl

Re: [Python-Dev] Python 2.6.3rc1 available

2009-10-04 Thread Nick Coghlan
Benjamin Peterson wrote: > 2009/9/30 Ben Finney : >> Barry Warsaw writes: >> >>> The first (and hopefully last) release candidate for Python 2.6.3 is >>> now available >> […] >> >> Thank you for this announcement, and the efforts that go into making >> this work available. >> >> *Especially* thank

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

2009-10-04 Thread Barry Scott
On 1 Oct 2009, at 10:37, M.-A. Lemburg wrote: Eric Smith wrote: Martin v. Löwis wrote: Steven Bethard wrote: There's a lot of code already out there (in the standard library and other places) that uses %-style formatting, when in Python 3.0 we should be encouraging {}-style formatting. I

Re: [Python-Dev] summary of transitioning from % to {} formatting

2009-10-04 Thread Nick Coghlan
Brett Cannon wrote: > No one is saying we should deprecate % any time soon on strings > themselves or anywhere. This discussion is purely in regards to > argparse and logging to transition *their* APIs over to {} formatting > which would most likely involve some deprecation for *using* % > formatti

Re: [Python-Dev] summary of transitioning from % to {} formatting

2009-10-04 Thread Nick Coghlan
Antoine Pitrou wrote: > If we can't find a way to make things almost transparent, we should IMO > abandon > the whole idea of a transition. Yep - this is the reason some attempts at actual format translation implementations started up as a result of the previous discussion. Without that, I suspec

Re: [Python-Dev] Python 2.6.3rc1 available

2009-10-04 Thread Benjamin Peterson
2009/9/30 Ben Finney : > Barry Warsaw writes: > >> The first (and hopefully last) release candidate for Python 2.6.3 is >> now available > […] > > Thank you for this announcement, and the efforts that go into making > this work available. > > *Especially* thank you for avoiding the oxymoronic “Rel