On Sun, Sep 23, 2012 at 7:55 PM, Olivier Grisel <[email protected]> wrote: > 2012/9/23 Olivier Grisel <[email protected]>: >> >> The only clean solution for the collapsed base of numpy 1.7 I see >> would be to replace the direct mmap.mmap buffer instance from the >> numpy.memmap class to use a custom wrapper of mmap.mmap that would >> still implement the buffer python API but would also store the >> filename and offset as additional attributes. To me that sounds like a >> much cleaner than a "global scorecard of all extant memory mappings". > > Rather than a wrapper for mmap.mmap we could just subclass it actually. > This is even cleaner: very few code change and would not break user > code testing for `isintance(a.base, mmap.mmap)` or similar.
You'd need a subclass in either case, but the advantage of the "global scorecard" (which would just be a sorted python list) is that in your approach, you depend on all code everywhere passing around .base values in the way you expect, but in my version the memmap pickle code would only need to rely on a tiny bit of code that's maintained alongside it in the same file. That's what I consider cleaner. -n _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
