A newbie in more need....

Chris Patton chrispatton at gmail.com
Fri Oct 1 06:34:05 CEST 2004

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!!

More information about the Python-list mailing list