[Python-3000] Thoughts on dictionary views

Steven Bethard steven.bethard at gmail.com
Tue Feb 20 16:08:12 CET 2007


On 2/20/07, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
> * ISTM that views offer three benefits:  re-iterability, set behavior, and
> self-updates.  IMO, the first is not commonly needed and is trivially served by
> writing list(mydict.items()) or somesuch.  The second is best served by an
> explicit conversion to a set or frozenset type
[snip]
> My recommendation is to take a more conservative route.  Let's make dicts as
> simple as possible and then introduce a new collections module entry with the
> views bells and whistles.

Just to clarfiy, you're suggesting that we still change .keys()
.values() and .items() to iterators, right?

If so, +1.  I was also starting to get a bit nervous about the new
complexity of dict().  Putting the view-like behavior into the
collections module makes good sense.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list