[Python-3000] PEP - string.format

Jim Jewett jimjjewett at gmail.com
Mon Apr 24 18:22:11 CEST 2006


On 4/22/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Talin wrote:

> > 2) Otherwise, see if the value to be formatted has a __format__ method.  If
> > it does, then call it.

> So an object can override standard parsing like {0:d} to return something
> other than an integer? *shudder*

There are several unicode characters which serve as digits in other
scripts.  Even given that {0:d} means the string representing this
integer in base 10, that may not specify the exact characters to
return.

This doesn't make it less scary, but it is a valid use case, if
parsing can be overridden.

-jJ


More information about the Python-3000 mailing list