def expand_gufunc_template(template, indims, outdims, funcname):
 argdims = (indims + outdims)
 argnames = ['arg{0}'.format(i) for i in range(len(argdims))]
 checkedarg = 'min({0})'.format(', '.join(['{0}.shape[0]'.format(a) for a in argnames]))
 inputs = [_gen_src_for_indexing(aref, adims, _gen_src_for_input_indexing) for (aref, adims) in zip(argnames, indims)]
 outputs = [_gen_src_for_indexing(aref, adims, _gen_src_for_output_indexing) for (aref, adims) in zip(argnames[len(indims):], outdims)]
 argitems = (inputs + outputs)
 src = template.format(name=funcname, args=', '.join(argnames), checkedarg=checkedarg, argitems=', '.join(argitems))
 return src

def expand_gufunc_template ( template , indims , outdims , funcname ) : argdims = ( indims + outdims ) argnames = [ 'arg{0}' . format ( i ) for i in range ( len ( argdims ) ) ] checkedarg = 'min({0})' . format ( ', ' . join ( [ '{0}.shape[0]' . format ( a ) for a in argnames ] ) ) inputs = [ _gen_src_for_indexing ( aref , adims , _gen_src_for_input_indexing ) for ( aref , adims ) in zip ( argnames , indims ) ] outputs = [ _gen_src_for_indexing ( aref , adims , _gen_src_for_output_indexing ) for ( aref , adims ) in zip ( argnames [ len ( indims ) : ] , outdims ) ] argitems = ( inputs + outputs ) src = template . format ( name = funcname , args = ', ' . join ( argnames ) , checkedarg = checkedarg , argitems = ', ' . join ( argitems ) ) return src
expand gufunc source template .