[Python-ideas] Customizing format()

Raymond Hettinger python at rcn.com
Wed Mar 18 22:44:24 CET 2009

>> My interpretation is that the conv-dictionary applies to the whole
>> string (not field-by-field) 
> That was not specified.  If so, then a statement like
> """A number such as {0:15.2f} can be formatted many ways:
> USA: {0:15,.2f), EU: {0:15<whatever>f},
> India: {0:15<whatever>f), China {0:15<whatever>f)"
> would not be possible.
> Why not allow extra flexibility?  Unless the conversion is set by 
> setting a global variable ala locale, the c-dict will be *used* 
> field-by-field in each call to ob.__format__(fmt, conv), so there is no 
> reason to force each call in a particular series to use the same conversion.

-1   Unattractive and unnecessary hyper-generalization.


More information about the Python-ideas mailing list