Dictionary self lookup
Norberto Lopes
shelika.void at gmail.com
Wed Jun 24 05:39:32 EDT 2009
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 another syntax
instead of:
a = { "foo" : "foo1" }
a["bar"] = a["foo"]
Maybe I'm murdering python syntax/philosophy right here so let me know
if that's the case.
I was thinking this could probably be done in python abstract tree but
as I never looked into it I may be wrong. I'm willing to make the
effort, provided I get some directions and that this idea is worth it.
Any feedback is welcome.
Cheers,
Norberto
More information about the Python-list
mailing list