Exercises
For local development, a few small utility functions can make your life much easier. We have already seen an example of this with the print_code
generator and the trace
context wrapper. See if you can extend one of these to:
- Execute code with a timeout so you can see where your application is stalling
- Measure the duration of the execution
- Show how often that specific bit of code has been executed
-
Example answers for these exercises can be found on GitHub: https://github.com/mastering-python/exercises. You are encouraged to submit your own solutions and learn about alternative solutions from others.