[Numpy-discussion] frompyfunc question

2012-06-20 Thread Larsen, Brian A
Hello all, I was looking to wrap hasattr in a numpy ufunc and got some weird behavior. Here is a transcript: In [5]: import numpy as np In [6]: np.__version__ Out[6]: '1.6.2' In [7]: b = [1,2,3] In [7]: nphas = np.frompyfunc(hasattr, 2, 1) In [8]: hasattr(b, 'extend') Out[8]: True In [9]: nphas(b

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread Larsen, Brian A
This is the stack overflow discussion mentioned. http://stackoverflow.com/questions/9164269/can-you-tell-if-an-array-is-a-view-of-another I basically implemented the answer from SO. I feel like the "is" gives you a good handle on things since to be true they are actually the same location in m

Re: [Numpy-discussion] Determining the 'viewness' of an array, and flags.owndata confusion

2012-02-28 Thread Larsen, Brian A
Stack overflow post related to this: http://stackoverflow.com/questions/9164269/can-you-tell-if-an-array-is-a-view-of-another On Feb 28, 2012, at 4:01 PM, Kurt Smith wrote: For an arbitrary numpy array 'a', what does 'a.flags.owndata' indicate? I originally thought that owndata is False iff '

[Numpy-discussion] PyArray_FromAny() steals a reference to PyArray_Descr* dtype

2012-02-15 Thread Larsen, Brian A
Hello all, the docs are unclear as to the reference counting on the inputs to the numpy C function PyArray_FromAny(). multiarraymodule.c in the PyArray_InnerProduct() code seems to imply that a reference to dtype is stolen in the PyArray_FromAny process. Meaning that I don't need/can't have a