[Numpy-discussion] Questions about the array interface.
Scott Gilbert
xscottg at yahoo.com
Thu Apr 7 04:35:49 EDT 2005
--- Travis Oliphant <oliphant at ee.byu.edu> wrote:
> >
> > 2) As __array_strides__ is optional, I'd kind of like to have a
> > __contiguous__ flag that I could just check, rather than checking for
> > the existence of strides, then calculating what the strides should be,
> > then checking them.
>
>
> I don't want to add too much. The other approach is to establish a set
> of helper functions in Python to check this sort of thing: Thus, if
> you can't handle a general array you check:
>
> ndarray.iscontiguous(obj)
>
> where obj exports the array interface.
>
> But, it could really go either way. What do others think?
>
I think this should definitely be done in the helper functions. Having
extra attributes encode redundant information is a recipe for trouble.
Cheers,
-Scott
More information about the NumPy-Discussion
mailing list