![](https://secure.gravatar.com/avatar/6dcbad6503875324049cdad1f2426e3a.jpg?s=120&d=mm&r=g)
Oct. 7, 2018
10:13 a.m.
Anders wrote
An mmap object is one of the things you can make a memoryview of, although looking again, it seems you don't even need to, you can just re.search the mmap object directly.
re.search'ing the mmap object means the operating system takes care of the streaming for you, reading in parts of the file only as necessary.
Provided mmap releases memory when possible, this is a good solution, and probably in many cases better than the one I suggested. And closer to what the original poster asked for. So I've learnt something. Thank you all. -- Jonathan