diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-09-13 22:06:48 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-09-13 22:06:48 +0000 |
commit | 795e498cd628ceb407d03c171d8659917d71f893 (patch) | |
tree | e94913f934d2dfe6e9c3532006b6a304405f2196 /numpy/core/ma.py | |
parent | 27775e944be6e089bc6a3e58e9e97d58b1079067 (diff) | |
download | numpy-795e498cd628ceb407d03c171d8659917d71f893.tar.gz |
Add itemset method to parallel item method
Diffstat (limited to 'numpy/core/ma.py')
-rw-r--r-- | numpy/core/ma.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/numpy/core/ma.py b/numpy/core/ma.py index 18a4e9a8a..5bd7ed7d2 100644 --- a/numpy/core/ma.py +++ b/numpy/core/ma.py @@ -1360,16 +1360,22 @@ array(data = %(data)s, return self._data.dtype dtype = property(fget=_get_dtype, doc="type of the array elements.") - def item(self): - "Return Python scalar if possible." + def item(self, *args): + "Return Python scalar if possible" if self._mask is not nomask: - m = fromnumeric.ravel(self._mask) + m = self._mask.item(*args) try: if m[0]: return masked except IndexError: return masked - return self._data.item() + return self._data.item(*args) + + def itemset(self, *args): + "Set Python scalar into array" + item = args[-1] + args = args[:-1] + self[args] = item def tolist(self, fill_value=None): "Convert to list" |