Dual look-up on keys?
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Wed Mar 5 18:18:50 EST 2008
On Wed, 05 Mar 2008 14:51:04 -0800, castironpi wrote:
> Anyway, if (a,b) is a key in dictionary d, can it guarantee that (b,a)
> is also in it, and maps to the same object?
It would take you approximately five seconds to answer that question for
yourself.
>>> D = {(1,2): "x"}
>>> D[(2,1)]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: (2, 1)
You've already been plonked by one long-time regular today. Are you
aiming to get plonked by *everybody*?
http://en.wikipedia.org/wiki/Plonk
--
Steven
More information about the Python-list
mailing list