(no subject)
Kragen Sitaker
kragen at pobox.com
Tue Nov 27 17:10:12 EST 2001
toffer_ji0 at subdimension.com writes:
> is it possible to call or rather use an instantiated class using, say
> a string (assuming unique)..
Do you want to instantiate new classes at run-time, or do you want to
be able to choose among a set of classes that already exist based on a
string? The latter can be done with getattr or a dict or (*shudder*)
eval. The former can be done in a variety of ways; the easiest is
probably to have a class inside a function. Every time the function
runs, it will produce a new class.
More information about the Python-list
mailing list