> foo = {'a':1, 'b':2, 'c':foo['a']}
TRy
foo = {'a':1, 'b':2}
foo['c'] = foo['a']
The only reasobn it ddidn't work before was that
foo didn't exist at the time you tried to add the reference.
foo['c'] is just a reference to whatever foo['a'] references.
foo['d'] = foo
is a tad more interesting however.
especially if you do
foo['d']['d']['b'] = 42
As a mental excercise...
Now what does foo look like? :-)
> I know that as above doesn't work, but was just wondering if it's
> possible, and if it's a
> Bad Thing?
It's possible and may be a good thing depending on what you are trying
to do. It certainly shouldn't be a regular thing!
Alan G.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor