[Python-Dev] Default formatting
Serhiy Storchaka
storchaka at gmail.com
Thu Oct 27 05:51:43 EDT 2016
On 27.10.16 02:44, Eric V. Smith wrote:
> But on the other hand, the existing behavior is well specified and has
> been around since object.__format__ was added. I'm not sure it needs
> changing. What's the harm in leaving it?
More complicated code. And maybe this behavior is less intuitive. It
contradicts the documentation.
From the documentation of the format() builtin [1]:
"The default format_spec is an empty string which usually gives the same
effect as calling str(value)."
From the description of the format specification mini-language [2]:
"A general convention is that an empty format string ("") produces the
same result as if you had called str() on the value."
[1] https://docs.python.org/3/library/functions.html#format
[2] https://docs.python.org/3/library/stdtypes.html#str.format
More information about the Python-Dev
mailing list