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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to