<p dir="ltr"><br>
On 12 Mar 2014 07:51, <<a href="mailto:random832@fastmail.us">random832@fastmail.us</a>> wrote:<br>
><br>
> On Tue, Mar 11, 2014, at 16:25, Ethan Furman wrote:<br>
> > > Is % formatting not going to be updated to support new features<br>
> ><br>
> > No.<br>
> ><br>
> > > or fix bugs like this?<br>
> ><br>
> > It's not a bug.  Decimal is not float.<br>
><br>
> The bug to which I was referring involves not calling __format__ on<br>
> whatever object is passed in as str.format does - Decimal not being<br>
> float is no impediment to str.format and Decimal.__format__ accepting<br>
> the same format strings that float.__format__ does.<br>
><br>
> > >  Is it going to be deprecated?<br>
> ><br>
> > No.  %-formatting has its place.<br>
><br>
> What place is that?<br>
><br>
>     There should be one-- and preferably only one --obvious way to do<br>
>     it.<br>
><br>
> We've got two syntaxes, and two functions, that do _almost_ the same<br>
> thing, but with two completely different microlanguages. Why?</p>
<p dir="ltr">Start by reading PEP 3101, which added str.format to address the limitations of mod-formatting.</p>
<p dir="ltr">For new users, the recommendation is unconditional: use str.format.</p>
<p dir="ltr">mod-formatting is now a power tool for optimisation, consistency with C implementations, templating format strings without excessive escaping and (the main reason it still exists), backwards compatibility (both for existing code and existing programmers).</p>

<p dir="ltr">The original plan was to eventually deprecate mod-formatting entirely, but not only did we discover that was harder than expected, we also found it was actually incredibly useful in some cases to have a formatting system available that relied on coercion rather than polymorphism, since it could be faster, was more predictable and also more easily mapped to other languages like C (especially since Python's mod-formatting is based on C's printf syntax).</p>

<p dir="ltr">That's why the binary interpolation proposal for 3.5 now *only* proposes restoring mod-formatting for the binary domain, leaving str.format as a text domain only operation.</p>
<p dir="ltr">Cheers,<br>
Nick.</p>
<p dir="ltr">> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>