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

Chris Jerdonek report at bugs.python.org
Tue Sep 18 21:39:26 CEST 2012

Chris Jerdonek added the comment:

Here is a proposed patch.

One note on the patch.  I feel the second sentence of the note is worth adding because value.__format__() departs from what PEP 3101 says:

"Note for Python 2.x: The 'format_spec' argument will be either
a string object or a unicode object, depending on the type of the
original format string.  The __format__ method should test the type
of the specifiers parameter to determine whether to return a string or
unicode object.  It is the responsibility of the __format__ method
to return an object of the proper type."

The extra sentence will help in heading off and when responding to issues about value.__format__() that are similar to issue 15951.

keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file27218/issue-15952-1-branch-27.patch

Python tracker <report at bugs.python.org>

More information about the docs mailing list