Counting entries in a list of dictionaries: for loop vs. list comprehension with map(itemgetter)
- by Dennis Williamson
In a Python program I'm writing I've compared using a for loop and increment variables versus list comprehension with map(itemgetter) and len() when counting entries in dictionaries which are in a list. It takes the same time using a each method. Am I doing something wrong or is there a better approach?
Here is a greatly simplified and shortened…