Last active
August 8, 2019 07:39
-
-
Save a-recknagel/55716d6a9b333ccf1455213a54507320 to your computer and use it in GitHub Desktop.
Callstacks
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
# no callstack, we directly crash through to the intepreter | |
>>> raise ValueError() | |
Traceback (most recent call last): | |
File "<input>", line 1, in <module> | |
ValueError | |
# we raise in a function, we crash to line two, which called the function | |
>>> def a(): | |
... raise ValueError() | |
... | |
>>> a() | |
Traceback (most recent call last): | |
File "<input>", line 1, in <module> | |
File "<input>", line 2, in d | |
ValueError | |
# now the long (but not much more complicated) version, if we crash we just go to the most recent call site | |
>>> def d(): | |
... raise ValueError() | |
... def c(): | |
... d() | |
... def b(): | |
... c() | |
... def a(): | |
... b() | |
... | |
>>> a() | |
Traceback (most recent call last): | |
File "<input>", line 1, in <module> | |
File "<input>", line 8, in a | |
File "<input>", line 6, in b | |
File "<input>", line 4, in c | |
File "<input>", line 2, in d | |
ValueError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment