Tim Chase wrote:

>>>> fact = lambda i: i > 1 and reduce(mul, xrange(1, i+1)) or not
> i and 1 or None
> 
> Stunts like this would get a person fired around here if they
> were found in production code :)

eheh, indeed.


def fact(n):
     try:
         return eval('*'.join(str(x) for x in range(1,n+1)))
     except:
         return 1
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to