On Thu, Apr 5, 2012 at 11:57 AM, Olivier Delalleau <[email protected]> wrote:
> Le 5 avril 2012 11:45, Neal Becker <[email protected]> a écrit :
>
> You can do:
>
> f = numpy.frompyfunc(lambda x: x.some_attribute == 0, 1, 1)
>
> Then
> f(array_of_objects_x)

This is handy too:

agetattr = numpy.frompyfunc(getattr, 2, 1)

array_of_values = agetattr(array_of_objects, 'some_attribute')
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to