I have a function for getting an item from a dict:
def dict_lookup(dictionary, key):
return dictionary[key]
I'll be mapping this function via multiprocessing to look up values from a series of very long dicts:
dictlist = [{}, {}, {}]
dict_lookup_partial = functools.partial(dict_lookup, key=some_key)
with multiprocessing.Pool() as pool:
values = pool.map(dict_lookup_partial, dictlist)
I feel like I shouldn't have to define a function for getting a value from a dict. Is there some inbuilt way to do this?