Eryk Sun <eryk...@gmail.com> added the comment:
> Or, obviously: > > with open(fn, 'rb') as fd: > with mmap.mmap(fd.fileno(), 0, access=mmap.ACCESS_READ) as mm: > with memoryview(mm)[:2] as data: > print(data) Doesn't this rely on the immediate finalization of the unreferenced memoryview instance that creates the slice? It would be nice if memoryview supported alternate constructors memoryview(obj, stop) and memoryview(obj, start, stop[, step]). ---------- nosy: +eryksun _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35686> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com