dictionaries/pointers

Rob Conner rtconner at gmail.com
Fri Oct 7 17:23:49 EDT 2005


I dont know how to do this and can't think of a simple way to.

All I want is a dictionary where two keys point to the same object.
(to steal the ascii art from
http://starship.python.net/crew/mwh/hacks/objectthink.html)
I want sometihng like this:

,------.       +-------+
| dict |------>|+-----+|     +---+
`------'       || "a" |+---->| 1 |
               |+-----+|     +---+
               |       |       ^
               |+-----+|       |
               || "b" |+-------'
               |+-----+|
               +-------+
               |       |
               |+-----+|     +---+
               || "c" |+---->| 2 |
               |+-----+|     +---+
               +-------+

Where if I change "a" or "b" to 3 the other one will change?
Is this even possible? How would I do it?




More information about the Python-list mailing list