From the course: Python: Decorators

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Challenges with debugging

Challenges with debugging - Python Tutorial

From the course: Python: Decorators

Challenges with debugging

- We have a problem. By replacing a function with another callable, we've lost important metadata. Let me show you with an example, and then we'll look at a couple of solutions. So head over to the file called debugging.py, and we'll use that as our starting point. You will probably recognize one of the functions from our make posh challenge question. So let's head over to the REPL. So I'm in the same folder as my debugging.py file. And so from debugging import my two functions, so make_posh and printfib. Now let's print out printfib's function name and doc string. So that's just printfib and dunder name and printfib and dunder doc. So, so far, so good. You've got the name printfib and we've got the docstring for printfib. Now many editors and the help function uses the docstring. So for example if I typed help and printfib, I get the docstring for the printfib function. So, so far, so good. Now let's see what…

Contents