[Numpy-discussion] setting the attributes of an array of object

jelle jelleferinga@gmail....
Sat Sep 29 04:03:48 CDT 2007


Hi,

I'm wondering whether i can re-write the following idiom with numpy arrays:

for i in some_list:
   i.some_attr = some_value

it would be wonderful if one was able to write this idiom as

arr[just_these].some_attr = some_value
or
setattr(arr[just_these], 'some_attr', some_value)

since often expensive loops through lists of object could be avoided.

any thoughts on this are much appreciated,

thanks,

-jelle



More information about the Numpy-discussion mailing list