[Python-Dev] mmapfile module

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Tue, 28 Mar 2000 21:46:17 +0200


Andrew M. Kuchling wrote:
> The issue there is cross-platform compatibility; the Windows and Unix
> versions take completely different constructor arguments, so how
> should we paper over the differences?
>=20
> Unix arguments: (file descriptor, size, flags, protection)
> Win32 arguments:(filename, tagname, size)
>=20
> We could just say, "OK, the args are completely different between
> Win32 and Unix, despite it being the same function name".  Maybe
> that's best, because there seems no way to reconcile those two
> different sets of arguments.

I don't get this.  Why expose low-level implementation details
to the user (flags, protection, tagname)?

(And how come the Windows implementation doesn't support
read-only vs. read/write flags?)

Unless the current implementation uses something radically
different from mmap/MapViewOfFile, wouldn't an interface like:

    (filename, mode=3D"rb", size=3Dentire file, offset=3D0)

be sufficient?  (where mode can be "wb" or "wb+" or "rb+",
optionally without the "b")

</F>