[Python-Dev] Adding bytes.frombuffer() constructor to PEP 467
INADA Naoki
songofacandy at gmail.com
Thu Jan 5 19:11:54 EST 2017
More information about the Python-Dev mailing list
Thu Jan 5 19:11:54 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 ]
>
> bytes.frombuffer(x) is bytes(memoryview(x)) or memoryview(x).tobytes().
>
There is pitfall: memoryview should be closed.
So b = bytes.frombuffer(x) is:
with memoryview(x) as m:
b = bytes(m)
# or b = m.tobytes()
- 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