[Numpy-discussion] extension to xrange for numpy

Alan G Isaac aisaac at american.edu
Sun Apr 2 06:58:34 EDT 2006


On Sun, 02 Apr 2006, Gary Ruben apparently wrote: 
> I'd find some sort of numpy iterator equivalents of these more 
> useful. This would allow list comprehensions like 
> [f(x,y,z) for (x,y,z) in ndrange(10,10,10)] 

How is this better than using ogrid? E.g.,

>>> x=N.ogrid[:3,:2]
>>> N.power(*x)
array([[1, 0],
       [1, 1],
       [1, 2]])

Thanks,
Alan







More information about the NumPy-Discussion mailing list