Skip to content
loading...

re: Pythonic way to aggregate or group elements in a list using dict.get and dict.setdefault VIEW POST

TOP OF THREAD FULL DISCUSSION
re: This is just too magical, and hard to understand. items_by_type = {} for item in items: items_by_type.setdefault(item.type, list()).append(it...
 

You are right😁, fortunately there are several ways to do things in Python. I am more concerned about using dictionary methods. Thank you

code of conduct - report abuse