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
| import other | |
| def thrower(): | |
| raise other.Exp1 | |
| def catcher(): | |
| try: | |
| thrower() | |
| except other.Exp1, other.Exp2: | |
| pass | |
| catcher() | |
| x = other.Exp2("some message") | |
| # Outputs: | |
| # TypeError: 'Exp1' object is not callable | |
| # ???????? | |
| # except other.Exp1, other.Exp2 is equivalent to | |
| # except other.Exp2 as other.Exp2, creating an alias. | |
| # Enjoy strange errors throughout your code :-) | |
| # Correct: | |
| # except (other.Exp1, other.Exp2): |