Skip to Content
Clean Code in Python
book

Clean Code in Python

by Mariano Anaya
August 2018
Intermediate to advanced
332 pages
9h 12m
English
Packt Publishing
Content preview from Clean Code in Python

Tracing code

When talking about tracing in this section, we will refer to something more general that has to do with dealing with the execution of a function that we wish to monitor. This could refer to scenarios in which we want to:

  • Actually trace the execution of a function (for example, by logging the lines it executes)
  • Monitor some metrics over a function (such as CPU usage or memory footprint)
  • Measure the running time of a function
  • Log when a function was called, and the parameters that were passed to it

In the next section, we will explore a simple example of a decorator that logs the execution of a function, including its name and the time it took to run.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Clean Code in Python - Second Edition

Clean Code in Python - Second Edition

Mariano Anaya
Python for Programmers

Python for Programmers

Paul Deitel, Harvey Deitel

Publisher Resources

ISBN: 9781788835831Supplemental Content