Can't roughly the same thing be achieved with % substitution?<br>>>> msg = '%s == %s'<br>>>> print(msg % ('.format', 'improvement'))<br>.format == improvement<br>>>> msg % ('Python', 'greatness')<br>
'Python == greatness'<br><br>The main non-syntactic difference here is that msg is a normal string object rather than a bound method.<br><br>Not arguing against moving to .format, just that it doesn't seem inherently more powerful than % in this case. (I guess you could still argue that this pattern alleviates a concern with .format, namely repeated typing of .format, but that's never been an issue with % to begin with.)<br>
<br><div class="gmail_quote">On Thu, Feb 12, 2009 at 05:10, spir <span dir="ltr"><<a href="mailto:denis.spir@free.fr">denis.spir@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Le Wed, 11 Feb 2009 20:06:37 -0500,<br>
Terry Reedy <<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>> a écrit :<br>
<div class="Ih2E3d"><br>
> One thing probably not mentioned in the PEP is the possibility of bound<br>
> methods, reduces typing of '.format' for reused formats.<br>
><br>
>  >>> msg = "{0} == {1}".format<br>
>  >>> print(msg('.format', 'improvement'))<br>
> .format == improvement<br>
>  >>> msg('Python', 'greatness')<br>
> 'Python == greatness'<br>
<br>
</div>This is relevant. I've read the PEP and was not aware of such a wide open door. It allows building collections of string formats. Why not makes them public? Why not e.g. start a wiki page for common useful formats? Why not then store them into a standard module?<br>

<br>
I see loads of uses in the sole field of UI.<br>
"Please, enter a {0}."<br>
"Hello, {0}! Ausgeschlafen? Press enter to continue..." (slept well?)<br>
"name: {0} -- phone:{1} -- email{2}"<br>
<br>
Denis<br>
------<br>
la vida e estranya<br>
<div><div></div><div class="Wj3C7c">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>It is better to be quotable than to be honest.<br>    -Tom Stoppard<br><br>Borowitz<br>