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

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Jan 12 18:23:00 CET 2014


On 12/01/2014 17:06, Mark Shannon wrote:
> On 12/01/14 16:52, Kristján Valur Jónsson wrote:
>> Now you're just splitting hairs, Nick.
>>
>> An explicit operator, %s, _defined_ to be "encode a string object using
>> strict ascii",
>
> I don't like this because '%s' reads to me as "insert *string* here".
> I think '%a' which reads as "encode as ASCII and insert here" would be
> better.
>

I entirely agree.  This would also parallel the conversion flags given 
here http://docs.python.org/3/library/string.html#format-string-syntax, 
I quote "Three conversion flags are currently supported: '!s' which 
calls str() on the value, '!r' which calls repr() and '!a' which calls 
ascii()".

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence



More information about the Python-Dev mailing list