[Python-Dev] 3.1 and 2.7 break format() when used with complex (sometimes)
Eric Smith
eric at trueblade.com
Tue Feb 23 19:36:30 CET 2010
> The root cause of this problem is object.__format__, which is basically:
>
> def __format__(self, fmt):
> return str(self).__format__(fmt)
>
> So here we're changing the type of the object (to str) but still keeping
> the same format string. That doesn't make any sense: the format string
> is type specific. I think the correct thing to do here is to make it an
> error if fmt is non-empty. In 2.7 and 3.2 I can make this a
> PendingDeprecationWarning, then in 3.3 a DeprecationWarning, and finally
> make it an error in 3.4.
I have this implemented in issue 7994 with a PendingDeprecationWarning.
Unless someone objects I'm going to document it and apply the patch.
Eric.
More information about the Python-Dev
mailing list