I am trying to create an array of object. I am able to do it like this:
def MyClass(object):
def __init__(self, number=0):
self.number=number
my_objects = []
for i in range(100) :
my_objects.append(MyClass(0))
I want, however, to create the array without the loop (because I think for a more complex object the appending can be very time consuming). Is there a way to achieve this?