[Python-3000] docstring for dict.values (original) (raw)

Guido van Rossum guido at python.org
Fri Jul 27 18:55:27 CEST 2007


That's a totally different issue. The result of .items() is a set. But if it contains an unhashable object you can't convert it to a regular set.

--Guido

On 7/27/07, Lisandro Dalcin <dalcinl at gmail.com> wrote:

It seems the same applies to dict.items() ...

$ set(dict(a=[]).items()) >>> set(dict(a=[]).items()) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list'

On 7/27/07, Guido van Rossum <guido at python.org> wrote: > On 7/27/07, Lisandro Dalcin <dalcinl at gmail.com> wrote: > > Why the docstrings for 'dict.values' says "a set-like object ..." ?? > > > > >>> list(dict(a=1,b=1,c=1).values()) > > [1, 1, 1] > > Oops, that's a bug! Thanks for reporting. -- Lisandro DalcĂ­n

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-3000 mailing list