Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51242 > unrolled thread
| Started by | Ethan Furman <ethan@stoneleaf.us> |
|---|---|
| First post | 2013-07-25 09:21 -0700 |
| Last post | 2013-07-25 09:21 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Python 3: dict & dict.keys() Ethan Furman <ethan@stoneleaf.us> - 2013-07-25 09:21 -0700
| From | Ethan Furman <ethan@stoneleaf.us> |
|---|---|
| Date | 2013-07-25 09:21 -0700 |
| Subject | Re: Python 3: dict & dict.keys() |
| Message-ID | <mailman.5110.1374769265.3114.python-list@python.org> |
On 07/25/2013 09:11 AM, Prasad, Ramit wrote: > Terry Reedy wrote: >> >> On 7/24/2013 4:34 PM, Prasad, Ramit wrote: >> >>> I am still not clear on the advantage of views vs. iterators. >> >> A1: Views are iterables that can be iterated more than once. Therefore, >> they can be passed to a function that re-iterates its inputs, or to >> multiple functions. They support 'x in view' as efficiently as possible. >> Think about how you would write the non-view equivalent of '(0,None) in >> somedict.views())'. When set-like, views support some set operations. >> For .keys, which are always set-like, these operations are easy to >> implement as dicts are based on a hashed array of keys. > > Hmm, that is a change that makes some sense to me. Does the view > get updated when dictionary changes or is a new view needed? I > assume the latter. Nope, the former. That is a big advantage that the views have over concrete lists: they show the /current/ state, and so are always up-do-date. -- ~Ethan~
Back to top | Article view | comp.lang.python
csiph-web