[SciPy-user] About arrays and objects

Enrique Comesaña Figueroa ecomesana@googlemail....
Thu Nov 13 10:36:01 CST 2008


Is it possible to list a property from an object array without using a
'for' loop?

I've created the array using:

In [1]: from numpy import *

In [2]: class nodo:
  ...:     def __init__(self, pos=0):
  ...:         self.pos = pos

In [3]: nodo_array = array ([nodo(1),nodo(2),nodo(3),nodo(4),nodo(5)])

I want to print the "node_array" using  something like this:

In [4]: print nodo_array[:].pos

without using a for loop.

Is that possible?


More information about the SciPy-user mailing list