Interpreter and library.
Révision | c6b46e5f018ab16120a1425496632c39f030ecf3 (tree) |
---|---|
l'heure | 2021-12-24 12:09:07 |
Auteur | ![]() |
Commiter | Simon Forman |
Py 3 handles exception propagation a little differently?
@@ -61,11 +61,10 @@ def joy(stack, expression, dictionary, viewer=None): | ||
61 | 61 | |
62 | 62 | term, expression = expression |
63 | 63 | if isinstance(term, Symbol): |
64 | - try: | |
65 | - term = dictionary[term] | |
66 | - except KeyError: | |
64 | + if term not in dictionary: | |
67 | 65 | raise UnknownSymbolError(term) |
68 | - stack, expression, dictionary = term(stack, expression, dictionary) | |
66 | + func = dictionary[term] | |
67 | + stack, expression, dictionary = func(stack, expression, dictionary) | |
69 | 68 | else: |
70 | 69 | stack = term, stack |
71 | 70 |