News for hackers. Stuff that matters.
Re:The Evolution of a Python Programmer by tomku on Thursday March 08, 2012 @01:39PM (#3680963)
The "Python expert" version doesn't run, but it's not hard to fix:

  import operator as op
  import functools as f
  fact = lambda x: f.reduce(op.mul, range(1, x + 1))
  print(fact(6))
If you're using Python 2.x, you can make it a bit shorter due to reduce being in the default namespace:

  import operator as op
  fact = lambda x: reduce(op.mul, xrange(1, x + 1))
  print fact(6)

There are no comments on this comment yet.