def tensor_indices(s, typ):
 if isinstance(s, str):
  a = [x.name for x in symbols(s, seq=True)]
 else:
  raise ValueError('expecting a string')
 tilist = [TensorIndex(i, typ) for i in a]
 if (len(tilist) == 1):
  return tilist[0]
 return tilist

def tensor_indices ( s , typ ) : if isinstance ( s , str ) : a = [ x . name for x in symbols ( s , seq = True ) ] else : raise ValueError ( 'expecting a string' ) tilist = [ TensorIndex ( i , typ ) for i in a ] if ( len ( tilist ) == 1 ) : return tilist [ 0 ] return tilist
returns list of tensor indices given their names and their types parameters s : string of comma separated names of indices typ : list of tensorindextype of the indices examples .