To find an easy way to print the runtime of a function, I found an interesting Python library: funcy.
We can directly use decorator ‘@print_durations()’ like this:
Python
x
4
1
from funcy import print_durations
2
()
3
def my_func1():
4
...
There are also some other interesting decorators:
Python
1
3
1
2
def ip_to_city(ip):
3
...