Message373141
I'd like to add optional argument to lru_cache.
This argument is a user given function that will replace the default behaviour of creating a key from the args/kwds of the function.
for example:
def my_make_key(my_list):
return my_list[0]
@lru_cache(128, make_key=my_make_key)
def cached_func(my_list):
return sum(my_list)
This will creating a cached function that accepts immutable.
Also, It will allow user to add custom functions from knowledge about the expected function input, without the need to create custom classes and/or overriding __hash__ |
|
Date |
User |
Action |
Args |
2020-07-06 16:51:10 | Itayazolay | set | recipients:
+ Itayazolay |
2020-07-06 16:51:10 | Itayazolay | set | messageid: <1594054270.54.0.203199023298.issue41220@roundup.psfhosted.org> |
2020-07-06 16:51:10 | Itayazolay | link | issue41220 messages |
2020-07-06 16:51:10 | Itayazolay | create | |
|