def _cast_inplace(terms, acceptable_dtypes, dtype):
 dt = np.dtype(dtype)
 for term in terms:
  if (term.type in acceptable_dtypes):
   continue
  try:
   new_value = term.value.astype(dt)
  except AttributeError:
   new_value = dt.type(term.value)
  term.update(new_value)

def _cast_inplace ( terms , acceptable_dtypes , dtype ) : dt = np . dtype ( dtype ) for term in terms : if ( term . type in acceptable_dtypes ) : continue try : new_value = term . value . astype ( dt ) except AttributeError : new_value = dt . type ( term . value ) term . update ( new_value )
cast an expression inplace .