So I'm currently working with mongoengine, although anything with properties will have the same behavior.
I have a list called collections. Technically it's a mongoengine QuerySet, which is an iterable, but it has virtually all the same behaviors as a list.
Each element collections is an object, with a property called addons which is also a list.
I want to create a flat list of all the addons. Currently doing this produces the desired result
addons = []
for col in collections:
addons+=col.addons
But when I try this, which I assume is the equivalent list comprehension, I get a list of lists (it essentially appends each list together instead of adding them)
addons = [col.addons for col in collections]
I've been reading about nested list comprehensions and even using itertools but haven't been able to figure out how to get either to work properly