News for hackers. Stuff that matters.
Re:Computer History Museum 2018 Fellow: Guido van Rossum by joshuamorton on Thursday February 22, 2018 @12:15PM (#16439193)
heck, if you really want that:

    @functools.lru_cache
    def fibs(n):
        if n == 0:
            return 0
        elif n == 1:
            return 1
        else:
            return fibs(n-1) + fibs(n-2)
Technically you could also write it as

    def f(n):
        if n in {0, 1}:
            return n
        return f(n-1) + f(n-2)
which is a bit trickier, but arguably better matches the way the seed values are described in english.

There are no comments on this comment yet.