[Numpy-discussion] Masking through generator arrays

Chris Barker chris.barker at noaa.gov
Thu May 10 14:23:27 EDT 2012

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

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.



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the NumPy-Discussion mailing list