Dynamic classes

Dave Rose s_david_rose at hotmail.com
Fri Nov 25 16:47:16 CET 2005


Hello all.
  I was wondering if creating classes could be dynamic.  I want to know if I 
can make a class Person, then read in a list of names (say people's names) 
so then I can have a class instance created for each name in the list?

  Why do I want to do this?  I was just thinking if I had a name on the 
list, Dave, I could then be able to read the name in the list, and assign 
Maria.birthday = <> and all the other attributes I would want to use a class 
for, except this is dynamic.  I don't know how to iterate thru the list to 
assign the different attributes yet, but this seemed reasonable to want to 
do, and thought I could learn from this.

Thanks!
Dave 





More information about the Python-list mailing list