[Tutor] Dynamic creation of class instances...

Lloyd Kvam pythontutor@venix.com
Fri, 24 May 2002 18:31:27 -0400


Since this topic is still continuing, I'll toss in my two cents.

The more conventional languages require that variables get declared before they
are used.  People have no chance to create names on the fly.  The other extreme
includes scripting languages with "macro" abilities where variables can hold
the names of other variables (${$name}).

Python allows the creation of variable names, but you can't save a new name in
another variable - macro style.  You have to save it in a container: a class,
dictionary, or list.  I think a beginner can reach a stage where they are ready
to create variables dynamically, but haven't gotten comfortable with the containers.
They grope for some non-container to hold the newly created variable name so that
they can just start using it.

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice: 
603-443-6155
fax: 
801-459-9582