![](https://secure.gravatar.com/avatar/087bc3a6b2fe0dbbf39ca49f40e2bac1.jpg?s=120&d=mm&r=g)
In python, if na is a numarray:
I can type
nb[0][0]=17
nb and na share data. How do you write nb = na[:,:4] in a C extension module? Thanks, Daniel Holth
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Thu, 2004-01-29 at 23:12, Daniel Holth wrote:
Here's the quick and dirty way: nb = (PyArrayObject *) PyObject_CallMethod(na, "view", NULL); if (na->dimensions[1] >= 4) nb->dimensions[1] = 4; Todd
-- Todd Miller Space Telescope Science Institute 3700 San Martin Drive Baltimore MD, 21030 (410) 338 - 4576
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Thu, 2004-01-29 at 23:12, Daniel Holth wrote:
Here's the quick and dirty way: nb = (PyArrayObject *) PyObject_CallMethod(na, "view", NULL); if (na->dimensions[1] >= 4) nb->dimensions[1] = 4; Todd
-- Todd Miller Space Telescope Science Institute 3700 San Martin Drive Baltimore MD, 21030 (410) 338 - 4576
participants (2)
-
Daniel Holth
-
Todd Miller