Created
April 6, 2016 10:00
-
-
Save Newlifer/2c9918456c8a713fd95bdadacd714128 to your computer and use it in GitHub Desktop.
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
class Value (Exception): | |
def __init__ (self, vl): | |
self._vl = vl | |
def __int__ (self): | |
return self._vl | |
def add (a, b): | |
raise Value(a + b) | |
def mul (a, b): | |
raise Value(a * b) | |
a = 2 | |
b = 2 | |
try: | |
add (a, b) | |
except Value as rs: | |
try: | |
mul (int(rs), b) | |
except Value as rs2: | |
print (int (rs2)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment