Cache Keys Must Come From the Resolved Call

Every cache should have one property, and plenty do not: turning it on changes how fast your code runs and nothing else. If attaching a cache can change the answers , it has stopped being an optimization and become a correctness feature with a performance side effect. The most common way to lose that property in Python is a decorator that builds its key out of kwargs .