[Numpy-discussion] apply 'getitem to each element of obj array?

Adam Hughes hugadams@gwmail.gwu....
Thu Apr 5 10:41:23 CDT 2012


If you are storing objects, then can't you store them in a list and just do:

for obj in objectlist:
     obj.attribute = value

Or am I misunderstanding?

On Thu, Apr 5, 2012 at 11:31 AM, Neal Becker <ndbecker2@gmail.com> wrote:

> I have an array of object.
>
> How can I apply attribute access to each element?
>
> I want to do, for example,
> np.all (u.some_attribute == 0) for all elements in u?
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120405/8378acdf/attachment-0001.html 


More information about the NumPy-Discussion mailing list