[SciPy-user] Best/Safest way to parse NumPy array in C extension?

Lou Pecora lou_boog2000 at yahoo.com
Tue Dec 12 15:20:13 CST 2006


Thanks. I also found .flags.contiguous after some
googling.  You give a good example for the
non-contiguous case. 

-- Lou

--- Fernando Perez <fperez.net at gmail.com> wrote:

> On 12/12/06, Lou Pecora <lou_boog2000 at yahoo.com>
> wrote:
> 
> > I will have to learn how to check for contiguous
> in
> > Python.
> 
> Easy:
> 
> In [1]: import numpy as N
> 
> In [2]: a=N.arange(10)
> 
> In [3]: b=a[::2]
> 
> In [4]: a.flags.contiguous
> Out[4]: True
> 
> In [5]: b.flags.contiguous
> Out[5]: False
> 
> 
> Cheers,
> 
> f



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com


More information about the SciPy-user mailing list