@lower_builtin('setitem', types.Buffer, types.Any, types.Any)
def setitem_array(context, builder, sig, args):
 (aryty, idxty, valty) = sig.args
 (ary, idx, val) = args
 if isinstance(idxty, types.BaseTuple):
  index_types = idxty.types
  indices = cgutils.unpack_tuple(builder, idx, count=len(idxty))
 else:
  index_types = (idxty,)
  indices = (idx,)
 ary = make_array(aryty)(context, builder, ary)
 (index_types, indices) = normalize_indices(context, builder, index_types, indices)
 try:
  (dataptr, shapes, strides) = basic_indexing(context, builder, aryty, ary, index_types, indices)
 except NotImplementedError:
  use_fancy_indexing = True
 else:
  use_fancy_indexing = bool(shapes)
 if use_fancy_indexing:
  return fancy_setslice(context, builder, sig, args, index_types, indices)
 val = context.cast(builder, val, valty, aryty.dtype)
 store_item(context, builder, aryty, val, dataptr)

@ lower_builtin ( 'setitem' , types . Buffer , types . Any , types . Any ) def setitem_array ( context , builder , sig , args ) : ( aryty , idxty , valty ) = sig . args ( ary , idx , val ) = args if isinstance ( idxty , types . BaseTuple ) : index_types = idxty . types indices = cgutils . unpack_tuple ( builder , idx , count = len ( idxty ) ) else : index_types = ( idxty , ) indices = ( idx , ) ary = make_array ( aryty ) ( context , builder , ary ) ( index_types , indices ) = normalize_indices ( context , builder , index_types , indices ) try : ( dataptr , shapes , strides ) = basic_indexing ( context , builder , aryty , ary , index_types , indices ) except NotImplementedError : use_fancy_indexing = True else : use_fancy_indexing = bool ( shapes ) if use_fancy_indexing : return fancy_setslice ( context , builder , sig , args , index_types , indices ) val = context . cast ( builder , val , valty , aryty . dtype ) store_item ( context , builder , aryty , val , dataptr )
array[a] = scalar_or_array array[a .