[Python-ideas] Customizing format()
Terry Reedy
tjreedy at udel.edu
Wed Mar 18 21:14:38 CET 2009
Eric Smith wrote:
> Antoine Pitrou wrote:
>> Raymond Hettinger <python at ...> writes:
>>> Am curious whether you guys like this proposal?
>>
>> I find it good for the builtin format() function, but how does it work
>> for
>> str.format()?
>
> I agree: I like it, but it's not enough. I use str.format() way more
> often than I hope to ever use builtin format(). If we make any change,
> I'd rather see it focused on the format mini-language.
I agree. My impression was that format() was added mostly for
consistency with the policy of having a 'public' interface to special
methods, and that .__format__ was added to support str.format. Hence,
any new capability of .__format__ must be accessible from format strings
with replacement fields.
tjr
More information about the Python-ideas
mailing list