From c6b46e5f018ab16120a1425496632c39f030ecf3 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Thu, 23 Dec 2021 19:09:07 -0800 Subject: [PATCH] Py 3 handles exception propagation a little differently? --- joy/joy.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/joy/joy.py b/joy/joy.py index ad597a7..3b271b3 100644 --- a/joy/joy.py +++ b/joy/joy.py @@ -61,11 +61,10 @@ def joy(stack, expression, dictionary, viewer=None): term, expression = expression if isinstance(term, Symbol): - try: - term = dictionary[term] - except KeyError: + if term not in dictionary: raise UnknownSymbolError(term) - stack, expression, dictionary = term(stack, expression, dictionary) + func = dictionary[term] + stack, expression, dictionary = func(stack, expression, dictionary) else: stack = term, stack -- 2.11.0