[Python-Dev] Fwd: PEP 467: Minor API improvements for bytes & bytearray
Nick Coghlan
ncoghlan at gmail.com
Mon Aug 18 00:48:08 CEST 2014
More information about the Python-Dev mailing list
Mon Aug 18 00:48:08 CEST 2014
- Previous message: [Python-Dev] Fwd: PEP 467: Minor API improvements for bytes & bytearray
- Next message: [Python-Dev] Fwd: PEP 467: Minor API improvements for bytes & bytearray
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 18 Aug 2014 08:04, "Markus Unterwaditzer" <markus at unterwaditzer.net> wrote: > > On Sun, Aug 17, 2014 at 05:41:10PM -0400, Barry Warsaw wrote: > > I think the biggest API "problem" is that default iteration returns integers > > instead of bytes. That's a real pain. > > I agree, this behavior required some helper functions while porting Werkzeug to > Python 3 AFAIK. > > > > > I'm not sure .iterbytes() is the best name for spelling iteration over bytes > > instead of integers though. Given that we can't change __iter__(), I > > personally would perhaps prefer a simple .bytes property over which if you > > iterated you would receive bytes, e.g. > > I'd rather be for a .bytes() method, to match the .values(), and .keys() > methods on dictionaries. Calling it bytes is too confusing: for x in bytes(data): ... for x in bytes(data).bytes() When referring to bytes, which bytes do you mean, the builtin or the method? iterbytes() isn't especially attractive as a method name, but it's far more explicit about its purpose. Cheers, Nick. > > -- Markus > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140818/d0fa815a/attachment.html>
- Previous message: [Python-Dev] Fwd: PEP 467: Minor API improvements for bytes & bytearray
- Next message: [Python-Dev] Fwd: PEP 467: Minor API improvements for bytes & bytearray
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list