[Tutor] creating variables at runtime
David Maclagan
david@verso.org
Thu, 24 Jan 2002 13:51:24 +1000
Is is possible in python to create variables at runtime?
What I'm wanting to do is create instances of classes, given names
based on user input
ie
userinput = "NARF"
(something done to userinput) = MyClass(), such that NARF will be an
instance of MyClass.
There would need to be some munging of the input, to prevent the
created object from overwriting already existing stuff.
Is such a thing possible? Is it Bad and Wrong?
I'm a relatively raw newcomer using Py 2.1 under windows
David
-------
David Maclagan
David@verso.org