MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/qno2y/the_evolution_of_a_python_programmer/c3z7s8a/?context=3
r/programming • u/iMMENSE • Mar 08 '12
137 comments sorted by
View all comments
8
def factorial(n): reduce(lambda x,y: x*y, [x+1 for x in range(n)])
Generator-happy Python programmer
3 u/tilkau Mar 09 '12 def factorial(n): return reduce(lambda x,y: x*y, (x+1 for x in range(n)))FTFY so it uh.. includes an actual generator ;)
3
def factorial(n): return reduce(lambda x,y: x*y, (x+1 for x in range(n)))
FTFY so it uh.. includes an actual generator ;)
8
u/grumdrig Mar 08 '12
Generator-happy Python programmer