On 18-10-07 16.15, Ram Rachum wrote:
> I tested it now and indeed bytes patterns work on memoryview objects.
> But how do I use this to scan for patterns through a stream without
> loading it to memory?

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.

regards, Anders

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to