[Python-Dev] Adding bytes.frombuffer() constructor to PEP 467
Alexander Belopolsky
alexander.belopolsky at gmail.com
Fri Jan 6 17:33:27 EST 2017
More information about the Python-Dev mailing list
Fri Jan 6 17:33:27 EST 2017
- Previous message (by thread): [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467
- Next message (by thread): [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jan 6, 2017 at 4:43 PM, Serhiy Storchaka <storchaka at gmail.com> wrote: > Compare these two calls: >> >> from array import array >>>>> bytes(array('h', [1, 2, 3])) >>>>> >>>> b'\x01\x00\x02\x00\x03\x00' >> >> and >> >> bytes(array('f', [1, 2, 3])) >>>>> >>>> b'\x00\x00\x80?\x00\x00\x00@\x00\x00@@' >> > > I don't see a difference. Hmm indeed. Doesn't this contradict the documentation? >>> help(bytes) .. class bytes(object) | bytes(iterable_of_ints) -> bytes | bytes(string, encoding[, errors]) -> bytes | bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer .. This suggests that iterable_of_ints is tried first. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170106/37347723/attachment.html>
- Previous message (by thread): [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467
- Next message (by thread): [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list