Created
August 12, 2020 11:00
-
-
Save mahenzon/d77361a1bd44f138e706ae4734007ee6 to your computer and use it in GitHub Desktop.
Trace calls made to the decorated function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def trace(): | |
""" | |
Trace calls made to the decorated function. | |
@trace("____") | |
def fib(n): | |
.... | |
>>> fib(3) | |
--> fib(3) | |
____ --> fib(2) | |
________ --> fib(1) | |
________ <-- fib(1) == 1 | |
________ --> fib(0) | |
________ <-- fib(0) == 1 | |
____ <-- fib(2) == 2 | |
____ --> fib(1) | |
____ <-- fib(1) == 1 | |
<-- fib(3) == 3 | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment