I came across a situation where what I thought I wanted to do was to create
a class that was spawned from data in a .csv file. Where column 1 was the
name I wanted to use for each instance. I had it all figured out and
working except for how to write a statement where the left hand side could
be a changing identifier.
All I could figure out was how to create the same instance 50 times albeit
in different ways.
For example each row would look like [name, value1, value2, value3], I
planned on passing the three values as a tuple
The code would simply be:
for row in csvimport:
tuple = (row[1],row[2],row[3])
instancename = Classname(tuple)
How could I create different instances inside an iteration loop for each row
? Is it possible to change the name through modification of self attribute
(wait is self an attribute?) Are cats sleeping with dogs here or what?
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor