Re: Dictionary self lookup

2009-06-28 Thread Carl Banks
On Jun 27, 4:33 am, Jure Erznožnik wrote: > When you write code like > config = {"home" : "/home/test"} > config["user1"] = config["home"] + "/user1" > > config["user1"] isn't stored in memory as config["home"] + "/user1", > but as a concatenated string ("/home/test/user1"), composed of both > tho

Re: Dictionary self lookup

2009-06-27 Thread Jure Erznožnik
Norberto, While certainly useful, this kind of functionality contradicts the way today's "string" libraries work. What you are proposing isn't dict self referencing, but rather strings referencing other external data (in this case other strings from the same dict). When you write code like config

Re: Dictionary self lookup

2009-06-26 Thread Gabriel Genellina
En Wed, 24 Jun 2009 23:42:03 -0300, Carl Banks escribió: On Jun 24, 2:39 am, Norberto Lopes wrote: What do you think of dictionaries having a self lookup in their declaration? Be able to do this: a = {"foo" : "foo1", "bar" : a["foo"]} # or with another syntax instead of: a = { "foo" : "

Re: Dictionary self lookup

2009-06-24 Thread Carl Banks
On Jun 24, 2:39 am, Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. > > What do you think of dictionaries having a self lookup in their > declaration? > > Be able to do t

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 6:26 pm, Scott David Daniels wrote: > Norberto Lopes wrote: > > On Jun 24, 1:21 pm, "Diez B. Roggisch" wrote: > >> Norberto Lopes wrote: ... > >>> config = {"home" : "/home/test"} > >>> config["user1"] = config["home"] + "/user1" > >>> config["user2"] = config["home"] + "/user2" > >>>

Re: Dictionary self lookup

2009-06-24 Thread Scott David Daniels
Norberto Lopes wrote: On Jun 24, 1:21 pm, "Diez B. Roggisch" 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

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 1:21 pm, "Diez B. Roggisch" wrote: > Norberto Lopes wrote: > > On Jun 24, 11:59 am, "Diez B. Roggisch" wrote: > >> Norberto Lopes wrote: > >> > Hi all. > >> > Assuming that python dictionaries already provide a bit of "shoot > >> > yourself in the foot", I think what I have in mind wou

Re: Dictionary self lookup

2009-06-24 Thread Diez B. Roggisch
Norberto Lopes wrote: > On Jun 24, 11:59 am, "Diez B. Roggisch" wrote: >> Norberto Lopes wrote: >> > Hi all. >> > Assuming that python dictionaries already provide a bit of "shoot >> > yourself in the foot", I think what I have in mind would not be so >> > bad. >> >> What kind of foot-shooting do

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 12:05 pm, Chris Rebert wrote: > On Wed, Jun 24, 2009 at 2:39 AM, Norberto Lopes wrote: > > Hi all. > > Assuming that python dictionaries already provide a bit of "shoot > > yourself in the foot", I think what I have in mind would not be so > > bad. > > > What do you think of dictionarie

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 11:59 am, "Diez B. Roggisch" wrote: > Norberto Lopes wrote: > > Hi all. > > Assuming that python dictionaries already provide a bit of "shoot > > yourself in the foot", I think what I have in mind would not be so > > bad. > > What kind of foot-shooting do you have in mind? > a = { "foo

Re: Dictionary self lookup

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 2:39 AM, Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. > > What do you think of dictionaries having a self lookup in their > declaration? > > Be

Re: Dictionary self lookup

2009-06-24 Thread Diez B. Roggisch
Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. > > What do you think of dictionaries having a self lookup in their > declaration? > > Be able to do this: > > a = {"fo

Re: Dictionary self lookup

2009-06-24 Thread Diez B. Roggisch
Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. What kind of foot-shooting do you have in mind? > > What do you think of dictionaries having a self lookup in their > de

Dictionary self lookup

2009-06-24 Thread Norberto Lopes
Hi all. Assuming that python dictionaries already provide a bit of "shoot yourself in the foot", I think what I have in mind would not be so bad. What do you think of dictionaries having a self lookup in their declaration? Be able to do this: a = {"foo" : "foo1", "bar" : a["foo"]} # or with anot