Memory-mapped file objects behave like both bytearray and like
file objects. You can use mmap objects in most places where
bytearray are expected; for example, you can use the re module
to search through a memory-mapped file. You can also change a
single byte by doing obj[index] = 97, or change a subsequence by
assigning to a slice: obj[i1:i2] = b'...'. You can also read and
write data starting at the current file position, and seek()
through the file to different positions. A memory-mapped file is
created by the mmap constructor, which is different on Unix and
on Windows. In either case you must provide a file descriptor
for a file opened for update. If you wish to map an existing
Python file object, use its fileno() method to obtain the
correct value for the fileno parameter. Otherwise, you can open
the file using the os.open() function, which returns a file
descriptor directly (the file still needs to be closed when
done). If you want to create a memory-mapping for a writable,
buffered file, you should flu