def _multi_broadcast(*shapelist):
 assert shapelist
 result = shapelist[0]
 others = shapelist[1:]
 try:
  for (i, each) in enumerate(others, start=1):
   result = _pairwise_broadcast(result, each)
 except ValueError:
  raise ValueError('failed to broadcast argument #{0}'.format(i))
 else:
  return result

def _multi_broadcast ( * shapelist ) : assert shapelist result = shapelist [ 0 ] others = shapelist [ 1 : ] try : for ( i , each ) in enumerate ( others , start = 1 ) : result = _pairwise_broadcast ( result , each ) except ValueError : raise ValueError ( 'failed to broadcast argument #{0}' . format ( i ) ) else : return result
raises valueerror if broadcast fails .