Use a decorator

Let's see how we can write our own decorator and create a timing context manager.

We'll cover the following

Writing our own timer is a lot of fun too, although it may not be as accurate as just using timeit depending on the use case. Regardless, we’re going to write our own custom function timing decorator! Here’s the code:

Get hands-on with 1200+ tech skills courses.