[Python-Dev] d.get_key(key) -> key?

Daniel 'eikeon' Krech eikeon@eikeon.com
05 Jun 2002 18:41:12 -0400


"Barry Scott" <barry.alan.scott@ntlworld.com> writes:

> Why not store the key as part of the value.
> 
> 	d[a] = a
> 
> 	d[b] => a
> 
> If you need more info in the value put a class instance or a
> tuple with the key as part of the value.
> 
> 	d[a] = (a,1)

Ideally it would be nice not to have to store it as part of the
value. But that should work. Thank you.

I should have split my question clearly into two questions. Sorry for
dragging the off [python-dev] topic aspect of my question into this
list.

The question I tried (poorly) to raise to this list is if a
get_key(key) -> key as I described could be added to dictionary in
future versions of python. I know at least one user that would use it
:)

Thank you from a happy python user,
--eikeon