[Python-Dev] String formatting / unicode 2.5 bug?
John J Lee
jjl at pobox.com
Sun Aug 20 18:55:09 CEST 2006
On Sun, 20 Aug 2006, Neil Schemenauer wrote:
> John J Lee <jjl at pobox.com> wrote:
>> The note (4) says that the result will be unicode, but it doesn't say how,
>> in this case, that comes about. This case is confusing because the docs
>> claim string formatting with %s "converts ... using str()", and yet
>> str(a()) returns a bytestring. Does it *really* use str, or just __str__?
>> Surely the latter? (given the observed behaviour, and not reading the C
>> source)
>
> It uses __str__ and confirms that the returned object is a 'str' or
> 'unicode'. The docs are not precise but they were not for 2.4
> either. Note the following case:
[...]
OK, but I assume you're not saying that the fact that the docs were broken
in 2.4 implies they shouldn't be fixed now?
I would suggest revised wording, but I'm clearly confused about what
actually goes on under the hood...
John
More information about the Python-Dev
mailing list