[SciPy-dev] def __array__

David Goldsmith d_l_goldsmith@yahoo....
Tue Aug 18 12:09:54 CDT 2009


OK, I downloaded and unpacked numpy-1.3.0rc2.tar.gz and directory numpy\core\src\multiarray doesn't exist.  There's a src\multiarraymodule.c; that doesn't contain a single '__array__'; it does contain an argsort, however, and scrolling up, I see that's in PyArray_LexSort, w/ a preceding comment that confirms that the sorting is lexicographic, so I have the answer to my question.  But I'm left wondering why my directory structure is different from yours, Robert, and what problems that may cause me down the line.

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