From cb065464db0e22e3605f1c3eaa61943b1f8972a3 Mon Sep 17 00:00:00 2001 From: "J.J. Tolton" Date: Thu, 9 Nov 2017 20:15:57 -0500 Subject: [PATCH] fixed bug in get_in --- naga/tools.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/naga/tools.py b/naga/tools.py index 2d2bdf8..4dc7e51 100644 --- a/naga/tools.py +++ b/naga/tools.py @@ -53,7 +53,12 @@ def get_in(d, ks, not_found=None): :param not_found: what to return if keys not in d :return: val """ - return reduce(lambda x, y: x.get(y, {}), ks, d) or not_found + res = reduce(lambda x, y: x.get(y, {}), ks, d) + if res is None: + return not_found + else: + return res + def apply(fn, x):