parameters: (self, indx, value)
return_statement: return
docstring: x.__setitem__(i, y) <==> x[i]=y
  
          Set item described by index. If value is masked, masks those
          locations.
docstring_summary: x.__setitem__(i, y) <==> x[i]=y
docstring_tokens: x . __setitem__ ( i y ) < == > x [ i ] = y
function: def __setitem__(self, indx, value):
          """
          x.__setitem__(i, y) <==> x[i]=y
  
          Set item described by index. If value is masked, masks those
          locations.
  
          """
          if self is masked:
              raise MaskError('Cannot alter the masked element.')
          _data = self._data
          _mask = self._mask
          if isinstance(indx, str):
              _data[indx] = value
              if _mask is nomask:
                  self._mask = _mask = make_mask_none(self.shape, self.dtype)
              _mask[indx] = getmask(value)
              return
  
          _dtype = _data.dtype
  
          if value is masked:
              # The mask wasn't set: create a full version.
              if _mask is nomask:
                  _mask = self._mask = make_mask_none(self.shape, _dtype)
              # Now, set the mask to its value.
              if _dtype.names is not None:
                  _mask[indx] = tuple([True] * len(_dtype.names))
              else:
                  _mask[indx] = True
              return
  
          # Get the _data part of the new value
          dval = getattr(value, '_data', value)
          # Get the _mask part of the new value
          mval = getmask(value)
          if _dtype.names is not None and mval is nomask:
              mval = tuple([False] * len(_dtype.names))
          if _mask is nomask:
              # Set the data, then the mask
              _data[indx] = dval
              if mval is not nomask:
                  _mask = self._mask = make_mask_none(self.shape, _dtype)
                  _mask[indx] = mval
          elif not self._hardmask:
              # Set the data, then the mask
              _data[indx] = dval
              _mask[indx] = mval
          elif hasattr(indx, 'dtype') and (indx.dtype == MaskType):
              indx = indx * umath.logical_not(_mask)
              _data[indx] = dval
          else:
              if _dtype.names is not None:
                  err_msg = "Flexible 'hard' masks are not yet supported."
                  raise NotImplementedError(err_msg)
              mindx = mask_or(_mask[indx], mval, copy=True)
              dindx = self._data[indx]
              if dindx.size > 1:
                  np.copyto(dindx, dval, where=~mindx)
              elif mindx is nomask:
                  dindx = dval
              _data[indx] = dindx
              _mask[indx] = mindx
          return
function_tokens: def __setitem__ ( self , indx , value ) : if self is masked : raise MaskError ( 'Cannot alter the masked element.' ) _data = self . _data _mask = self . _mask if isinstance ( indx , str ) : _data [ indx ] = value if _mask is nomask : self . _mask = _mask = make_mask_none ( self . shape , self . dtype ) _mask [ indx ] = getmask ( value ) return _dtype = _data . dtype if value is masked : # The mask wasn't set: create a full version. if _mask is nomask : _mask = self . _mask = make_mask_none ( self . shape , _dtype ) # Now, set the mask to its value. if _dtype . names is not None : _mask [ indx ] = tuple ( [ True ] * len ( _dtype . names ) ) else : _mask [ indx ] = True return # Get the _data part of the new value dval = getattr ( value , '_data' , value ) # Get the _mask part of the new value mval = getmask ( value ) if _dtype . names is not None and mval is nomask : mval = tuple ( [ False ] * len ( _dtype . names ) ) if _mask is nomask : # Set the data, then the mask _data [ indx ] = dval if mval is not nomask : _mask = self . _mask = make_mask_none ( self . shape , _dtype ) _mask [ indx ] = mval elif not self . _hardmask : # Set the data, then the mask _data [ indx ] = dval _mask [ indx ] = mval elif hasattr ( indx , 'dtype' ) and ( indx . dtype == MaskType ) : indx = indx * umath . logical_not ( _mask ) _data [ indx ] = dval else : if _dtype . names is not None : err_msg = "Flexible 'hard' masks are not yet supported." raise NotImplementedError ( err_msg ) mindx = mask_or ( _mask [ indx ] , mval , copy = True ) dindx = self . _data [ indx ] if dindx . size > 1 : np . copyto ( dindx , dval , where = ~ mindx ) elif mindx is nomask : dindx = dval _data [ indx ] = dindx _mask [ indx ] = mindx return