[Numpy-discussion] Masking through generator arrays

Charles R Harris charlesr.harris at gmail.com
Thu May 10 15:17:56 EDT 2012


On Thu, May 10, 2012 at 1:14 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:

>
>
> On Thu, May 10, 2012 at 12:52 PM, Scott Ransom <sransom at nrao.edu> wrote:
>
>> On 05/10/2012 02:23 PM, Chris Barker wrote:
>> > On Thu, May 10, 2012 at 2:38 AM, Dag Sverre Seljebotn
>> > <d.s.seljebotn at astro.uio.no>  wrote:
>> >> What would serve me? I use NumPy as a glorified "double*".
>> >
>> >> all I want is my glorified
>> >> "double*". I'm probably not a representative user.)
>> >
>> > Actually, I think you are representative of a LOT of users -- it
>> > turns, out, whether Jim Huginin originally was thinking this way or
>> > not, but numpy arrays are really powerful because the provide BOTH and
>> > nifty, full featured array object in Python, AND a wrapper around a
>> > generic "double*" (actually char*, that could be any type).
>> >
>> > This is are really widely used feature, and has become even more so
>> > with Cython's numpy support.
>> >
>> > That is one of my concerns about the "bit pattern" idea -- we've then
>> > created a new binary type that no other standard software understands
>> > -- that looks like a a lot of work to me to deal with, or even worse,
>> > ripe for weird, non-obvious errors in code that access that good-old
>> > char*.
>> >
>> > So I'm happier with a mask implementation -- more memory, yes, but it
>> > seems more robust an easy to deal with with outside code.
>> >
>> > But either way, Dag's key point is right on -- in Cython (or any other
>> > code) -- we need to make sure ti's easy to get a regular old pointer
>> > to a regular old C array, and get something else by accident.
>> >
>> > -Chris
>>
>> Agreed.  (As someone who has been heavily using Numpy since the early
>> days of numeric, and who wrote and maintains a suite of scientific
>> software that uses Numpy and its C-API in exactly this way.)
>>
>> Note that I wasn't aware that the proposed mask implementation might (or
>> would?) change this behavior...  (and hopefully I haven't just
>> misinterpreted these last few emails.  If so, I apologize.).
>>
>>
> I haven't seen a change in this behavior, otherwise most of current numpy
> would break.
>
>
I suspect this rumour comes from some ideas for generator arrays (not
mine), but I would strongly oppose anything that changes things that much.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120510/a8c4aa44/attachment.html>


More information about the NumPy-Discussion mailing list