Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> We can make it a bit more terse using list comprehensions:

    import functools as ft
    def fact(n):
        lst = range(1, n)
        return ft.reduce(lambda acc, x: acc*x, lst)
Amusing that there's not a list comprehension in sight.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: