Underscore has a handy little function, findWhere() which can be used to find a certain structure in a list like
myList = [
{'name': 'Thor'},
{'name': 'Odin'},
{'name': 'Freya'},
{'name': 'Skadi'}
];
findWhere(myList, {'name': 'Skadi'});
result: [{'name': 'Skadi'}]
Better example:
my_list = [
{'name': 'Thor',
'occupation': 'God of Thunder',
'favorite color': 'MY HAMMER'}
{'name': 'Skadi',
'occupation': 'Queen of the Ice Giants',
'favorite color': 'purpz'}
]
findWhere(my_list, {'name': 'Skadi'})
result:
[{'name': 'Skadi',
'occupation': 'Queen of the Ice Giants',
'favorite color': 'purpz'}]
Alas, I cannot find anything similar in python. What would be a pythonic way to implement the same functionality?