def dup_apply_pairs(f, g, h, args, K):
 (n, m) = (len(f), len(g))
 if (n != m):
  if (n > m):
   g = (([K.zero] * (n - m)) + g)
  else:
   f = (([K.zero] * (m - n)) + f)
 result = []
 for (a, b) in zip(f, g):
  result.append(h(a, b, *args))
 return dup_strip(result)

def dup_apply_pairs ( f , g , h , args , K ) : ( n , m ) = ( len ( f ) , len ( g ) ) if ( n != m ) : if ( n > m ) : g = ( ( [ K . zero ] * ( n - m ) ) + g ) else : f = ( ( [ K . zero ] * ( m - n ) ) + f ) result = [ ] for ( a , b ) in zip ( f , g ) : result . append ( h ( a , b , * args ) ) return dup_strip ( result )
apply h to pairs of coefficients of f and g .