[Python-Dev] PEP 460 reboot (original) (raw)

Yury Selivanov yselivanov.ml at gmail.com
Mon Jan 13 19:08:12 CET 2014


On January 13, 2014 at 12:45:40 PM, R. David Murray (rdmurray at bitdance.com) wrote: [snip]

There is no use case in the sense you are asking, just like there is no real use case for '%s' % b'x' producing "b'x'". But the real use case is exactly the same: to let you know your code is screwed up without actually blowing up with a encoding Exception.

Blowing up with an encoding exception is the only sane method of making you aware that something is wrong. It’s much better than just keeping producing some broken output, until it gets noticed.

What’s the point of writing a piece of software that is working wrong without crashing?

For the record, I like Guido's logic and proposal. I don't understand Nick's objection, since I don't see the difference between the situation here where a string gets interpolated into bytes as 'xxx' and the corresponding situation where bytes gets interpolated into a string as b'xxx'. Why struggle to keep bytes interpolation "pure" if string interpolation isn’t?

Isn’t the whole point of this discussion to make python2 people who want to migrate on python3 happier?  What’s the point for them to have a ported python2 code that produces "Status: b’42’” for "b’Status: %d’ % 42”? And if you want to call ‘str’ on 42 and then encode the output in latin-1/ascii, then you’re just turning python3 in python2.



More information about the Python-Dev mailing list