> Alan Isaac wrote: > >>> #evaluate polynomial (coefs) at x using Horner's rule > >>> def horner(coefs,x): return reduce(lambda a1,a2: a1*x+a2,coefs) > > It just cannot get simpler or more expressive.
"Peter Otten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > But is it correct? Yes. > Are we merely employing different conventions for the order of coefficients > or is that simple and expressive lambda/reduce stuff obscuring an error? It is too simple and expressive to obscure an error. ;-) This is particularly important since coefficient order is not standardized across uses. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list