pytopia / CS-Tutorial

Source Code for CS Courses Offered by Ali Hejazizo
https://www.hejazizo.com
MIT License
187 stars 107 forks source link

stateful decorator example updated #8

Closed shirinyamani closed 2 years ago

shirinyamani commented 2 years ago

A new example block of cache has been added. It includes the pure cache decorator followed by the factorial function as an example of it! Later, another decorator @timer has provided to examine the ability of the former decorator with respect to the elapsed time of the function! it can also be a good sample for using several decorators on a single function. In the end, a little description is provided in regards to cache and lru_cache potential usage in Python versions.

hejazizo commented 2 years ago

A new example block of cache has been added. It includes the pure cache decorator followed by the factorial function as an example of it! Later, another decorator @timer has provided to examine the ability of the former decorator with respect to the elapsed time of the function! it can also be a good sample for using several decorators on a single function. In the end, a little description is provided in regards to cache and lru_cache potential usage in Python versions.

Thanks Shirin. The new examples are great.