[Numpy-discussion] memmap from fd?
Sun Jan 11 20:23:01 CST 2009
Robert Kern wrote:
> That's a fair point. However, given the wider range of issues that you
> had in trying to get memmap to work with your device, perhaps we
> should just state that the memmap class is intended for the common use
> case of regular files. The detection of the existing file size is
> quite useful in that case. For special files where seek() et al. might
> have different semantics, one should either subclass memmap to get the
> behavior you need, or simply use frombuffer() or ndarray() on the mmap
> object directly. The two reasons for the memmap class are the
> auto-length-detection and tracking the lifetime of the open file. The
> former you don't need (and can't do), and the latter isn't that hard
> to do yourself.
> Does that sound reasonable?
Hmm. frombuffer sounds nice, but python mmap doesn't expose buffer interface (I just added a feature request for this). I suppose I could write my own mmap module.
I couldn't find the reference to ndarray(). Any pointer?
More information about the Numpy-discussion