differentially loading a class at runtime
Michael Hoffman
m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Wed Oct 13 17:55:37 EDT 2004
Maurice LING wrote:
> How can I differentially use the classes at runtime?
I'm not completely sure I understand what you want, but how about using
a dict instead of a list:
>>> class a: x = "foo"
...
>>> class b: x = "bar"
...
>>> allowed = dict(a=a, b=b)
>>> aobj = allowed['a']()
>>> aobj.x
'foo'
--
Michael Hoffman
More information about the Python-list
mailing list