On 03/11/2014 02:51 PM, random832@fastmail.us wrote:
On Tue, Mar 11, 2014, at 16:25, Ethan Furman wrote:
at some point prior, random832@fastmail.us wrote:
Is % formatting not going to be updated to support new features
No.
or fix bugs like this?
It's not a bug. Decimal is not float.
The bug to which I was referring involves not calling __format__ on whatever object is passed in as str.format does - Decimal not being float is no impediment to str.format and Decimal.__format__ accepting the same format strings that float.__format__ does.
That is not a bug. str.__mod__ is not documented as calling an object's __format__ method, and indeed it does not.
Is it going to be deprecated?
No. %-formatting has its place.
What place is that?
There should be one-- and preferably only one --obvious way to do it.
You'll notice the word 'preferably' in there. The preferred method is format. %-formatting has a good place in lazy evaluation (in logging, for example), as well as other areas.
We've got two syntaxes, and two functions, that do _almost_ the same thing, but with two completely different microlanguages. Why?
Because % was there first, but had some failings that are addressed by format. -- ~Ethan~