d-d
d-d

Reputation: 1815

Python memoization decorator

I was looking for an example of a memoization decorator in Python2.

So far I found this one (in official? wiki): https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize

My question is: does anybody see a bug in this code?

Line #13: if not isinstance(args, collections.Hashable) will always return True, since args will always be a hashable tuple.

Am I wrong?

Upvotes: 2

Views: 76

Answers (1)

Amber
Amber

Reputation: 526793

Yes, that appears to be an error in the code.

It appears to have been introduced in this edit.

Upvotes: 1

Related Questions