"Daryl V" <[email protected]> wrote

What I want to do is use the first entry in that row (row[0]) as the
variable name for the instantiated class.

Thats usually a very bad idea. Not least because all the code that
comes after it would somehow, magically, have to know about this
brand new variable that has appeared.

Its generally better to store these kinds of things in a list or dictionary.
You can use the name as the key into the dictionary if you like.

Then you can process the dictionary like any other collection of objects.
Or you can refer to specific ones using the name. And the previously
written code doen't get confused aboutt unexpected names appearing.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to