Wouldn't it be nice to have numpy a little more generic?
All that would be needed was a little check of the arguments.

If I do:
numpy.trace(4)
shouldn't numpy be smart enough to regard the 4 as a 1x1 array?
numpy.sin(4) works!

and if
x = my_class(4)

wouldn't it be nice if

numpy.trace(x)
would call
x.trace() ?

numpy.sin(my_class(4)) works!

Wouldn't it be nice if numpy worked a little more consistent.
Is this worth a ticket? Or am I missing something here?











On Fri, Jan 30, 2009 at 10:05 PM, Robert Kern <robert.k...@gmail.com> wrote:
> On Fri, Jan 30, 2009 at 13:18, Christopher Barker <chris.bar...@noaa.gov> 
> wrote:
>> I think you want to subclass an ndarray here. It's a bit tricky to so,
>> but if you look in the wiki and these mailing list archives, you'll find
>> advise on how to do it.
>
> That still won't work. numpy.linalg.inv() simply does a particular
> algorithm on float and complex arrays and nothing else.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>  -- Umberto Eco
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to