why doesn't an mmap.mmap object have some kind of memoryview method?
Cameron Simpson
cs at cskk.id.au
Sun Aug 5 19:28:13 EDT 2018
More information about the Python-list mailing list
Sun Aug 5 19:28:13 EDT 2018
- Previous message (by thread): machine learning forums
- Next message (by thread): why doesn't an mmap.mmap object have some kind of memoryview method?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm tinkering with a module which scans video files. The MP4 parser has a `discard_data` parameter which tells certain parts of the parser to discard some of the scanned data, particularly the MDAT box parse because I don't normally want to blow the machine's RAM on a huge video stream - I'm normally parsing out the semantic info such as metadata. However, I would _like_ to keep it available in a frugal fashion if I can, and it seems to me that the mmap module is ideal: map the file into memory, use the file itself as the backing store, and return views of the mmap. But slicing a mmap object returns a bytes, which I _imagine_ to be a copy of the file data instead of a view into the mapping (because bytes are supposed to be immutable, and in theory some other actor might change the file even though I myself have it mapped read only). It seems obvious to me that a method returning a memoryview of the mapped file would be very handy here: no data copies at all, and not even any I/O unless the data are accessed. But I see no such method in the documentation. Does anyone have any insight here? Cheers, Cameron Simpson <cs at cskk.id.au>
- Previous message (by thread): machine learning forums
- Next message (by thread): why doesn't an mmap.mmap object have some kind of memoryview method?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list