Is there something equivalent to Clojure's get-in function in Python? It gets the data at the given path in some data structure.
In Clojure it is used like:
(def employee
{:name "John"
:details {:email "info@domain.com"
:phone "555-144-300"}})
(get-in employee [:details :email]) ; => "info@domain.com"
If translated to Python syntax it would be used like:
dictionary = {'a': {'b': 10}}
get_in(dictionary, ['a', 'b']) # => 10
This function is used to access arbitrary data points in nestled data structures where the paths are not known at compile time, they are dynamic. More usage examples of get-in
can be found on clojuredocs.