
4 Feb
2015
4 Feb
'15
10:15 a.m.
Sebastian Berg <sebastian <at> sipsolutions.net> writes:
Python has a mechanism both for getting an item and for setting an item. The latter will end up doing this (python already does this for us): x[:,d,:,d] = x[:,d,:,d] + 1 so there is an item assignment going on (__setitem__ not __getitem__)
- Sebastian
NumPy-Discussion mailing list NumPy-Discussion <at> scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Thanks for the prompt help Sebastian,
So can I use any legitimate ndarray indexing selection object, obj, in x.__setitem__(obj,y) and as long as y's shape can be broadcast to x[obj]'s shape it will always set the appropriate elements of x to the corresponding elements of y?