lambda (and reduce) are valuable
aisaac0 at verizon.net
Mon Dec 12 06:45:57 CET 2005
> 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" <__peter__ at web.de> wrote in message
news:dne702$j1q$02$1 at news.t-online.com...
> But is it correct?
> Are we merely employing different conventions for the order of
> 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
More information about the Python-list