[Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3 (original) (raw)
Guido van Rossum guido at python.org
Thu Mar 27 19:59:11 CET 2014
- Previous message: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3
- Next message: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Mar 27, 2014 at 11:52 AM, Daniel Holth <dholth at gmail.com> wrote:
I feel not including %s is nuts. Should I write .replace('%b', '%s')?
I assume you meant .replace('%s', '%b') (unless you're converting Python 3 code to Python 2, which would mean you really are nuts :-).
But that's not going to help for the majority of code using %s -- as I am trying to argue, %s doesn't mean "expect the argument to be a str" and neither is that how it's commonly used (although it's possible that that is how you use it exclusively -- that doesn't make you nuts, just more strict than most people).
All I desperately need are APIs that provide enough unicode / str type safety that I get an exception when mixing them accidentally... in my own code, dynamic typing is usually a bug. As has been endlessly discussed, %s for bytes is a bit like exposing sprintf()...
I don't understand that last claim (I can't figure out whether in this context is exposing sprintf() is considered good or bad). But apart from that, can you give some specific examples?
PS. I am not trying to be difficult. I honestly don't understand the use case yet, and the PEP doesn't do much to support it.
-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140327/17c22503/attachment.html>
- Previous message: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3
- Next message: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]