sh at ttsoftware.co.uk
Tue Dec 5 12:43:51 CET 2000
On Mon, 4 Dec 2000 17:45:46 +0100, "Alex Martelli" <aleaxit at yahoo.com>
>Attempts to get more sophisticated, such as
> import operator
> return reduce(operator.mul, range(1,f+1), 1L)
>will not necessarily bring happiness.
Might be faster with xrange (which doesn't build the whole list before
returning), but the simple for loop will probably still win for speed.
Functional-style list manipulations (once you are used to them) are
for speed of development, not speed of execution.
Home : steve at lurking.demon.co.uk
Work : sh at ttsoftware.co.uk
More information about the Python-list