[Python-3000] dict view operations (original) (raw)
Eduardo O. Padoan eduardo.padoan at gmail.com
Tue Sep 4 21:37:44 CEST 2007
- Previous message: [Python-3000] dict view operations
- Next message: [Python-3000] Should all iter(keys|items|values) be renamed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 9/4/07, Georg Brandl <g.brandl at gmx.net> wrote:
Georg Brandl schrieb:
Oh, and another thing: the items views can contain unhashable values, so
d.items() & d.items() will fail for such dictionaries since the operands are converted to sets before doing the intersection. I suspect there's nothing that can easily be done about that though...
Py3k-ish:
d = {2: [], 4: {}} d.items() & d.items() ... TypeError: list objects are unhashable
Must behave like Python 2.x-ish:
d = {2: [], 4: {}} set(d.items()) & set(d.items()) ... TypeError: list objects are unhashable
.. right? If so, IIUC, there is nothing to be done about that...
Georg
-- http://www.advogato.org/person/eopadoan/ Bookmarks: http://del.icio.us/edcrypt
- Previous message: [Python-3000] dict view operations
- Next message: [Python-3000] Should all iter(keys|items|values) be renamed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]