New Python 3.0 string formatting - really necessary?
steve at REMOVE-THIS-cybersource.com.au
Sat Dec 20 04:20:21 CET 2008
On Sat, 20 Dec 2008 01:54:35 +0000, Steven D'Aprano wrote:
> There clearly is a need for a more heavyweight formatting solution than
> % and string.Template. There are things that can't be done easily with %
> alone, and format() will make them much simpler. I have no objection to
> the addition of the format() method (although I wonder whether it might
> have been better as a function).
Except of course there is a format() function. Like len(), str() etc, it
just calls the appropriate special method on the argument:
format(obj, format_spec) -> obj.__format__(format_spec)
More information about the Python-list