[Python-3000-checkins] r53724 - in python/branches/p3yk: Lib/test/test_dictviews.py Objects/dictobject.c
Guido van Rossum
guido at python.org
Sun Feb 11 00:50:48 CET 2007
On 2/10/07, Brett Cannon <brett at python.org> wrote:
> > (I had dreams
> > of caching this by converting the values to a set, but was rudely
> > awakened when I realized that values don't need to be hashable. So
> > dict.values(), unlike dict.keys() and dict.items(), cannot return an
> > object that behaves and is as efficient as a set, without copying
> > anything; the only property I plan to implement (and have already done
> > so) is __iter__ which gives all the values in random order.
> Yeah, unless you want partial caching for those that are hashable, but
> at that point it probably isn't worth it.
I'd rather make it obvious that the values() view isn't all that
useful, rather than trying to hide the flaws until they pop up when
you least expect them. After all, the list returned by the current
values() method isn't all that useful either, so it's not like people
expect a lot from .values().
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000-checkins