This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dwt
Recipients dwt
Date 2014-01-08.13:34:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389188100.33.0.555885401078.issue20190@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-01-08 13:35:00dwtsetrecipients: + dwt
2014-01-08 13:35:00dwtsetmessageid: <1389188100.33.0.555885401078.issue20190@psf.upfronthosting.co.za>
2014-01-08 13:35:00dwtlinkissue20190 messages
2014-01-08 13:34:59dwtcreate