I have a class called Points
and I need to create 100 points.
I need to do something like:
class Point(object)
...
for i in range(1,100):
pi = Point()
the points should be named p1
, p2
, ... p100
The lines above do not work, obviously.
The question is: I know that I could use exec
inside a loop to create the 100 points but is there any better way to do it without using exec
?