|
|
|
|
|
by staz
3330 days ago
|
|
Your implementation suffer from a bug, if the final item is None it will return the default instead of None. A better implementation would be: def rget(d, *ks, **kwargs):
for k in ks:
if k not in d:
return kwargs.get('default')
d = d[k]
return d
|
|