I created a list of a specific length and noticed that all objects in the list have basically the same adress.
Question: How can I create the same list with different objects?
Example: bObject has a listA with 10 * objects of class A but. All those objects have the same adress (see debug screenshot below) and I would like to have 10 different objects. How do I have to change the creation of the list?
class geometry:
def __init__(self):
self.start = 0
self.end = 0
class AType:
def __init__(self):
self.a = 100
self.geo = geometry()
class BType:
def __init__(self):
self.listA = [AType()] * 10
self.d = 0
bObject = BType()
bObject.listA[0].geo.start = 0
bObject.listA[0].geo.end = 1
bObject.listA[1].geo.start = 2
bObject.listA[1].geo.end = 3