[Numpy-discussion] buffer arg to ndarray

Neal Becker ndbecker2@gmail....
Fri Sep 17 12:42:41 CDT 2010


np.ndarray description says:
  buffer : object exposing buffer interface

It's nice that it works with mmap:

b = mmap.mmap (...)
u = np.ndarray (buffer=b ...)

but you wouldn't know it from the above description.

It doesn't look to me that the object returned by mmap exposes the buffer 
interface, does it?

In [26]: dir(b)
Out[26]: 
['__add__',
 '__class__',
 '__delattr__',
 '__delitem__',
 '__delslice__',
 '__doc__',
 '__format__',
 '__getattribute__',
 '__getitem__',
 '__getslice__',
 '__hash__',
 '__init__',
 '__len__',
 '__mul__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__rmul__',
 '__setattr__',
 '__setitem__',
 '__setslice__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 'close',
 'find',
 'flush',
 'move',
 'read',
 'read_byte',
 'readline',
 'resize',
 'rfind',
 'seek',
 'size',
 'tell',
 'write',
 'write_byte']




More information about the NumPy-Discussion mailing list