En Fri, 28 Dec 2007 04:14:43 -0300, Michael Bernhard Arp Sørensen <[EMAIL PROTECTED]> escribió:
> I need to create objects on the fly in my program. The names of the > objects must be unique, obviously, and I need to put them in a list for > later use. > > How do i set the name of an object if the name is stored in another > variable? > > I've looked in the O'Reiley Python Cookbook and on google, but no joy. Use a dictionary as a container. py> ns = {} py> name = "Joe" py> o = object() py> ns[name] = o py> another = set("another") py> ns["another"] = another py> ns {'Joe': <object object at 0x009D0478>, 'another': set(['a', 'e', 'h', 'o', 'n', 'r', 't'])} -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list