Nadav Horesh wrote:
>Recently I had an idea to subclass numarray's array in order to
>implement a different scheme of array indexing via the __call__ method
>(ugly indeed, by my experience shows that it can be useful). It occurred
>to me that the array class is not in the spirit of Python 2.2+
>classes/types unification:
>
I agree.
> * The class name is not "trivial": numarraycore.NumArray
> * The class constructor is not built to be used by the commons.
>
I'm not sure what you have in mind here by "trivial" and "commons".
>Since arrays are normally generated by functions (zeros, array,
>fromfunction etc.) and not by the constructor, subclassing
>numarraycore.NumArray is not very useful. If, for instance, "array" (or
>"Array") would be the class name, where the constructor would optionally
>have the same parameters as the array function (with the option to act
>as a copy constructor as the array function does), then it would be easy
>to subclass it:
>
>class MyArray(array):
> ...
>
>
>new_array = MyArray(zeros((10,5), type=Int64))
>
>
>
This is desirable, with the present design, one has to go through a two
step process:
new_array = MyArray(type=Int64, shape= (10, 5))
load_some_data_into_array(new_array, zeros(10, 5))
Colin W.
> Any comments?
>
> Nadav.
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Numpy-discussion mailing list
>Num...@li...
>https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>
>
|