[Python-Dev] dict contains raises TypeError on unhashable input (original) (raw)

Ethan Furman ethan at stoneleaf.us
Sat Jul 20 03:30:23 CEST 2013


http://bugs.python.org/issue18510

Commenting further:

 some_key in dict

is conceptually the same as

 some_key in dict.keys()

which /would/ return False for an unhashable key -- at least it did in 2.x; for 3.x you have to say

 some_key in list(dict.keys())

which seems like a step backwards.

Is it worth changing contains and keys() to be in line with equality?

-- Ethan



More information about the Python-Dev mailing list