Created
October 4, 2017 22:54
-
-
Save m0xb/6431e4d7a0e125255c21c72d14819784 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| $ cat countdown_recursive_debug.py | |
| def countdown(n): | |
| print(f"DEBUG: enter countdown({n})") | |
| print(n) | |
| if n > 1: | |
| countdown(n - 1) | |
| print(f"DEBUG: exit countdown({n})") | |
| countdown(5) | |
| $ python3 countdown_recursive_debug.py | |
| DEBUG: enter countdown(5) | |
| 5 | |
| DEBUG: enter countdown(4) | |
| 4 | |
| DEBUG: enter countdown(3) | |
| 3 | |
| DEBUG: enter countdown(2) | |
| 2 | |
| DEBUG: enter countdown(1) | |
| 1 | |
| DEBUG: exit countdown(1) | |
| DEBUG: exit countdown(2) | |
| DEBUG: exit countdown(3) | |
| DEBUG: exit countdown(4) | |
| DEBUG: exit countdown(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment