Hacker News new | ask | show | jobs
by xapata 2957 days ago
A version of attr-lookup caching is already added in 3.7. Thus Guido objected to the tone of, "I'm the first person to notice this!"

> Mark Shannon said that Python 3.7 has added a feature that should provide a similar boost as the method-lookup caching used in the experiment.

As I understand it, class-attribute dicts now carry a version number which increments on every mutation. The first method lookup gets cached and subsequent lookups check the version number to decide whether to invalidate the cache.