On Mon, Nov 23, 2020, 2:58 PM Ethan Furman
if isinstance(node, StringNode): return node.value elif isinstance(node, NumberNode): return float(node.value) elif isinstance(node, ListNode): return [process_node(child_node) for child_node in
node.children]
elif isinstance(node, DictNode): return {key: process_node(child_node) for key, child_node
in node.children}
else: raise Exception('Unexpected node')
You don't need the "else".
Without the "else" errors will pass silently.
Not in the particular example. It can just be a bunch of ifs, each of which returns something. The last line of the function can be raise. Obviously, epic and else are very important in general. I think I wouldn't use any for that particular code though.