Resolves deeply-nested dictionary properties via dot-notation
Inspired by the node library selectn
So you can do:
selectn('info.name.full', person)
instead of:
person and person['info'] and person['info']['name'] and person['info']['name']['full']
$ pip install selectn-python
>>> from selectn import selectn
>>>
>>> dic = {'info': {'name': {'full': 'selectn'}}}
>>>
>>> selectn('info.name.full', dic)
'selectn'
>>> selectn('info.name.short', dic)
None
MIT © Søren Brokær