[New-bugs-announce] [issue20190] dict() in dict(foo='bar') raises
report at bugs.python.org
Wed Jan 8 14:35:00 CET 2014
New submission from Martin Häcker:
I was quite surprised by this behavior:
>>> dict() in [dict()]
>>> dict() in 
>>> dict() in dict(foo='bar').keys()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'dict'
>>> dict() in list(dict(foo='bar').keys())
I think it should change. Calling dict.keys() one expects to get list like behavior and not having to ensure that everything that is checked for inclusion there has to be hasheable.
If it helps, this is also a regression from python 2.6/7 where this works as expected.
title: dict() in dict(foo='bar') raises
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce