[Python-Dev] PEP 460: allowing %d and %f and mojibake

Ethan Furman ethan at stoneleaf.us
Sun Jan 12 17:21:20 CET 2014


On 01/12/2014 08:09 AM, Nick Coghlan wrote:
> On 13 Jan 2014 01:22, "Kristján Valur Jónsson" wrote:
>>
>> Imho, this is not equivalent to re-introducing automatic type conversion between binary/unicode, it is adding a specific convenience function for explicitly asking for ASCII encoding.
>
> It is not explicit, it is implicit - whether or not the resulting string assumes ASCII compatibility or not depends on
> whether you pass a binary value (no assumption) or a string value (assumes ASCII compatibility).

Nick, I don't understand what you are saying here.  Are you saying that the result of b'%s' % var may be either a bytes 
object or a str object?  Because that would be wrong -- it would always be a bytes object.

--
~Ethan~


More information about the Python-Dev mailing list