[Python-Dev] transitioning from % to {} formatting
Martin Geisler
mg at lazybytes.net
Fri Oct 2 21:43:48 CEST 2009
"Raymond Hettinger" <python at rcn.com> writes:
> [Steven Bethard]
>>. 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.
>
> 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)
too?
> I imagine that some people are heavily invested in %-formatting.
>
> Because there has been limited uptake on {}-formatting (afaict), we
> still have limited experience with knowing that it is actually better,
> less error-prone, easier to learn/rember, etc. Outside a handful of
> people on this list, I have yet to see anyone adopt it as the
> preferred syntax.
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.
--
Martin Geisler
VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20091002/d78d80ea/attachment.pgp>
More information about the Python-Dev
mailing list