C
Chris Patton
I am writing a program that writes a number of classes, which are all
fundementally the same thing. The only thing that is different is the
names. Therefore, I need to write a bunch of classes in the quickest
time I can. Here's what I was thinking of:
num = 1
while num < 20:
exec 'class bug'+num+':'
exec ' gender = "m"'
exec ' size = 0'
exec ' skill = 0'
Obviously, the "exec" statement severley slows the time it takes to
write these classes. I need a new method! If possible I would like to
avoid the use of the "exec" statement alltogether.
-- Thanks for any help!!
fundementally the same thing. The only thing that is different is the
names. Therefore, I need to write a bunch of classes in the quickest
time I can. Here's what I was thinking of:
num = 1
while num < 20:
exec 'class bug'+num+':'
exec ' gender = "m"'
exec ' size = 0'
exec ' skill = 0'
Obviously, the "exec" statement severley slows the time it takes to
write these classes. I need a new method! If possible I would like to
avoid the use of the "exec" statement alltogether.
-- Thanks for any help!!