[Python-ideas] Bind/normalize params for @functools.cache

2023-03-19 Thread Steve Jorgensen
I was surprised to find, when I pass arguments to a function decorated with `@functools.cache` in different, equivalent ways, the cache does not recognize them as the same. counter = itertools.count(1) @functools.cache def example(a, b, c=0): return (next(counter), a, b, c)

[Python-ideas] Re: Bind/normalize params for @functools.cache

2023-03-19 Thread Steve Jorgensen
Steve Jorgensen wrote: > I was surprised to find, when I pass arguments to a function decorated with > `@functools.cache` in different, equivalent ways, the cache does not > recognize them as the same. > counter = itertools.count(1) > @functools.cache > def example(a, b, c=0): > retur