[Numpy-discussion] array, asarray as contiguous and friends
Alexander Belopolsky
alexander.belopolsky at gmail.com
Fri Mar 24 08:28:07 CST 2006
On 3/24/06, Tim Hochberg <tim.hochberg at cox.net> wrote:
>.... For
example (and just for
> example, I make no great claims for either this name or interface):
> a = array_from_data(a_buffer_object, dtype, dims, strides)
>
This looks very similar to the current ndarray "new" constructor:
| ndarray.__new__(subtype, shape=, dtype=int_, buffer=None,
| offset=0, strides=None, fortran=False)
|
| There are two modes of creating an array using __new__:
| 1) If buffer is None, then only shape, dtype, and fortran
| are used
| 2) If buffer is an object exporting the buffer interface, then
| all keywords are interpreted.
| The dtype parameter can be any object that can be interpreted
| as a numpy.dtype object.
(see pydoc numpy.ndarray)
I would not mind to leave array() unchanged and move discussion to
streamlining ndarray.__new__ . For example, some time ago I suggested
that strides should be interpreted even if buffer=None.
More information about the Numpy-discussion
mailing list