[Numpy-discussion] one-offset arrays

Travis Oliphant oliphant.travis at ieee.org
Tue Aug 28 19:38:17 EDT 2001

Eric brought up the point of one-offset arrays which can be relatively easily 
created with UserArrays.

This led me to some thinking about why UserArrays are not more often used.

I think one of the biggest reasons is that most of the functions can take 
UserArrays but returned the basic array type upon completion.  So, you end up 
having to continually construct your UserArrays.

Are there other reasons people have thought of?

So, here's a suggestion:

Why don't we modify PyArray_Return to return an object of the same class as 
one of the arguments which was passed if the class defines an __array__ 

Which argument to pick and how this would be implemented without changing old 
code is an interesting question.

Assuming it were possible to cause PyArray_Return to do such a thing, would 
this be a bad idea?



Travis Oliphant

More information about the NumPy-Discussion mailing list