Serhiy Storchaka added the comment: Ah, there is a wart in the optimization in Python implementation. If call a cached function with multiple integer arguments and with equivalent float arguments, the second call will return a cached result. But if call with single integer and float arguments, both calls will be cached separately.
>>> import functools >>> @functools.lru_cache() ... def f(*args): ... return args ... >>> f(1, None) (1, None) >>> f(1.0, None) (1, None) >>> f.cache_info() CacheInfo(hits=1, misses=1, maxsize=128, currsize=1) >>> f.cache_clear() >>> f(1) (1,) >>> f(1.0) (1.0,) >>> f.cache_info() CacheInfo(hits=0, misses=2, maxsize=128, currsize=2) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29216> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com