[SciPy-dev] def __array__

David Goldsmith d_l_goldsmith@yahoo....
Tue Aug 18 11:13:53 CDT 2009


Hi, Robert.  I see you and I are paying about the same amount of attention to the ndarray discussion. ;-)

So, you saw me ask Stefan where to get the source, which I now have (again). :-)

I searched for __array__ and argsort, found plenty of 'em, but couldn't at a glance see how it treats character data, but now at least I have something substantive to study; thanks!

DG

--- On Tue, 8/18/09, Robert Kern <robert.kern@gmail.com> wrote:

> From: Robert Kern <robert.kern@gmail.com>
> Subject: Re: [SciPy-dev] def __array__
> To: "SciPy Developers List" <scipy-dev@scipy.org>
> Date: Tuesday, August 18, 2009, 8:48 AM
> On Tue, Aug 18, 2009 at 08:43, David
> Goldsmith<d_l_goldsmith@yahoo.com>
> wrote:
> > Is this in the compiled C code also?
> >
> > Someone (I think it was Pierre) recently asked me if I
> checked the code to see how something worked.  I "took the
> fifth," but I feel I needn't have: the real reason I haven't
> made a habit of it recently is (and maybe this is just due
> to the late stage we're at in the doc game), more often than
> not, the explanation I seek is buried in the compiled C
> code, and thus unfindable by me, at least with the
> technology I have at my disposal, and thus I'm at the
> "mercy" of the list for various explanations.
> >
> > To wit: trying to flesh out the details of how
> chararray.argsort works - I go examine the code and all it
> does is call self.__array__.  chararray doesn't appear to
> have an __array__ method, and I can't find one in ndarray
> either, so after checking all other leads, I finally
> remember that the main def of ndarray is in the compiled C
> code.  What's an innocent to do?
> 
> [~]$ cd ~/svn/numpy/numpy/core/src
> [src]$ grep -r __array__ .
> ....
> # AHA!
> ./multiarray/methods.c:    {"__array__",
> (PyCFunction)array_getarray,
> ....
> [src]$ grep -n array_getarray multiarray/methods.c
> 793:array_getarray(PyArrayObject *self, PyObject *args)
> 2032:    {"__array__",
> (PyCFunction)array_getarray,
> 
> 
> And there you can see that ndarray.__array__ implementation
> is on line
> 793 of multiarray/methods.c .
> 
> -- 
> 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
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Scipy-dev mailing list