[Python-3000] dict view operations
Eduardo O. Padoan
eduardo.padoan at gmail.com
Tue Sep 4 21:37:44 CEST 2007
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
More information about the Python-3000
mailing list