"Collapsing" a list into a list of changes

John Lenton john at grulic.org.ar
Mon Feb 7 15:54:55 EST 2005


On Mon, Feb 07, 2005 at 09:39:11PM +0100, Peter Otten wrote:
> John Lenton wrote:
> >                                         For example, the fastest way
> > to get the factorial of a (small enough) number in pure python is
> > 
> >   factorial = lambda n: reduce(operator.mul, range(1, n+1))
>  
> I see that you are seduced by the beauty of the expression. Otherwise, if
> you would really care for speed:
> 
> [...]

that's cheating: you moved the calculation into the setup. You aren't
timing what you say you are.

-- 
John Lenton (john at grulic.org.ar) -- Random fortune:
I'd rather push my Harley than ride a rice burner.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20050207/733142fc/attachment.sig>


More information about the Python-list mailing list