Last active
August 24, 2023 23:49
-
-
Save obfusk/a951133084492817dd7154af197e58fb to your computer and use it in GitHub Desktop.
weird python thing
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
>>> try: | |
... raise Exception("oops") | |
... except Exception as e: | |
... print("A", e) | |
... try: | |
... pass # raise Exception("uh-oh") | |
... except Exception as e: | |
... print("B", e) | |
... print("C", e) | |
... | |
A oops | |
C oops | |
>>> try: | |
... raise Exception("oops") | |
... except Exception as e: | |
... print("A", e) | |
... try: | |
... raise Exception("uh-oh") | |
... except Exception as e: | |
... print("B", e) | |
... print("C", e) | |
... | |
A oops | |
B uh-oh | |
Traceback (most recent call last): | |
File "<stdin>", line 2, in <module> | |
Exception: oops | |
During handling of the above exception, another exception occurred: | |
Traceback (most recent call last): | |
File "<stdin>", line 9, in <module> | |
NameError: name 'e' is not defined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment