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 rhettinger
Recipients dwt, rhettinger, vstinner
Date 2014-01-10.02:38:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389321516.19.0.55019167468.issue20190@psf.upfronthosting.co.za>
In-reply-to
Content
> I think the problem is that the API of dict.keys() is surprising.
> One gets back something that behaves like a list, the name 'keys'
> suggests that it is a list and for lists there is no requirement 
> that their containing items need to be hasheable.

The keys() method returns a view with set-like behavior (it supports union, intersection, difference, fast membership testing using hashed lookups, and iteration).

Guido modeled this behavior from a well established API in Java.

FWIW, it is hard for us to do anything about comments like "I was surprised ..."   The language behaviors are documented but that doesn't help if the docs aren't read.  If you expected a list-like object but received a set-like object, then you would get surprised.  There is not much that can be done about that.
History
Date User Action Args
2014-01-10 02:38:36rhettingersetrecipients: + rhettinger, vstinner, dwt
2014-01-10 02:38:36rhettingersetmessageid: <1389321516.19.0.55019167468.issue20190@psf.upfronthosting.co.za>
2014-01-10 02:38:36rhettingerlinkissue20190 messages
2014-01-10 02:38:35rhettingercreate