STINNER Victor added the comment: "key in dict" checks if dict has the specified key. Dictionary keys must be hashable. Dictionaries are not hashable.
> If it helps, this is also a regression from python 2.6/7 where this works as > expected. dict.keys() return a list in Python 2, whereas it returns a special object "dict_keys". The behaviour of Python 2 is more a side effect than an expected behaviour. Python 2: >>> dict() in dict(key="value") TypeError: unhashable type: 'dict' Python 3 behaviour is correct. ---------- nosy: +haypo resolution: -> invalid status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20190> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com