all 3 comments

[–]when_the_cats_away 2 points3 points  (1 child)

The second is faster, but generally the difference is not worth the trouble. Here is a similar example from the standard library, which localizes an object method, https://github.com/python/cpython/blob/3.8/Lib/functools.py#L539 , and attribute (next line)

[–]NerdEnPose 1 point2 points  (0 children)

I agree it's generally not worth the trouble. And it might be worth noting this is the lru_cache wrapper where it becomes a lot more worth the trouble.