May 2018
Intermediate to advanced
380 pages
9h 37m
English
The initial memoize_uw() decorator creates a blank dictionary to use as the cache. The enclosed memoize() function takes any number of arguments and looks to see whether any of them is a keyword; if so, a frozen set is used to take the arguments and use them as values for the keywords. If there are no keywords provided, then a new key:value item is created.
If the keyword is not already in the cache dictionary, then a new item is placed in the cache; otherwise, the cached item is pulled from the cache and becomes a return value. Finally, the entire decorator closes out and the final value is returned to the main program.
In the new _memoize() function, the same functionality is provided but, as the caller function to the decorator, ...