New submission from Martin Häcker:

I was quite surprised by this behavior:

>>> dict() in [dict()]
True
>>> dict() in []
False
>>> 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())
False

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.

----------
messages: 207683
nosy: dwt
priority: normal
severity: normal
status: open
title: dict() in dict(foo='bar') raises
versions: Python 3.2

_______________________________________
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

Reply via email to