Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
edited by

I can see that python 3.2 has memoization as a decorator in the functools module

Unluckily, it is not yet backported to 2.7. Is there any particular reason as to why it is not available in 2.7? Is there any 3rd party package implementing the same column or should I write my own?

1 Answer

0 votes
by (107k points)
edited by

Kindly be informed that the 2.x python line only gets bug fixes, and new specialties are developed for python 3.x only.

Simple usage:

from repoze.lru import lru_cache

@lru_cache(maxsize=500)

def fib(n):

    if n < 2:

        return n

    return fib(n-1) + fib(n-2)

Interested in learning Python? Enroll in our Python Course now.

Related questions

0 votes
4 answers
0 votes
1 answer
asked Jan 3, 2021 in Python by ashely (50.2k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...