Norberto Lopes wrote:
On Jun 24, 1:21 pm, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
Norberto Lopes wrote: ...
config = {"home" : "/home/test"}
config["user1"] = config["home"] + "/user1"
config["user2"] = config["home"] + "/user2"
config["python-dev"] = config["user1"] + "/py-dev"
I'd write this as:
home = "/home/test"
config = {"home" : home, "user1" : home + "/user1",
"user2" : home + "/user2", "python-dev" : home + "/py-dev"}
or even (if the list gets much longer):
home = "/home/test"
config = {"home" : "", "user1" : "/user1", "user2" : "/user2",
"python-dev" : "/py-dev"}
for key, entry in config.iteritems():
config[key] = home + entry
--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list