[docs] [issue15952] format(value) and value.__format__() behave differently with unicode format

Chris Jerdonek report at bugs.python.org
Mon Sep 17 08:26:11 CEST 2012

Chris Jerdonek added the comment:

See this code comment:

/* don't define FORMAT_LONG, FORMAT_FLOAT, and FORMAT_COMPLEX, since
   we can live with only the string versions of those.  The builtin
   format() will convert them to unicode. */

from http://hg.python.org/cpython/file/19601d451d4c/Python/formatter_unicode.c

In other words, it was deliberate not to make value.__format__(format_spec) return unicode when format_spec is unicode.  So the docs should be adjusted to say that they are not always the same.


Python tracker <report at bugs.python.org>

More information about the docs mailing list