I have a similar problem. Here's what I do: .def new_robot_named(name,indict=globals()): . execstr = name + " = robot('" + name + "')" . exec(execstr,indict)
.class robot(object): . def __init__(self,name): . self.name = name . def sayhi(self): . print "Hi! I'm %s!" % self.name .if __name__=="__main__": . new_robot_named('Bert') . new_robot_named('Ernie') . Ernie.sayhi() . Bert.sayhi() -- http://mail.python.org/mailman/listinfo/python-list