Skip to content

Commit

Permalink
fixed bug in get_in
Browse files Browse the repository at this point in the history
  • Loading branch information
jjtolton committed Nov 10, 2017
1 parent 37745f9 commit cb06546
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion naga/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit cb06546

Please sign in to comment.