I have a list of Objects and each object has inside it a list of other object type. I want to extract those lists and create a new list of the other object.
List1:[Obj1, Obj2, Obj3]
Obj1.myList = [O1, O2, O3]
Obj2.myList = [O4, O5, O6]
Obj3.myList = [O7, O8, O9]
I need this:
L = [O1, O2, O3, O4, ...., O9];
I tried extend()
and reduce()
but didn't work
bigList = reduce(lambda acc, slice: acc.extend(slice.coresetPoints.points), self.stack, [])
P.S.
Looking for python flatten a list of list didn't help as I got a list of lists of other object.