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

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


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
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,



More information about the Numpy-discussion mailing list