[Python-3000] Thoughts on dictionary views

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Feb 21 00:02:16 CET 2007

Raymond Hettinger wrote:

> * Maintaining a live (self-updating) view is a bit tricky from an implementation 
> point-of-view.

I don't understand what the alternative is. If mutating the
underlying object doesn't affect the view, then you don't
really have a view, just a copy of the data -- no different
from the existing dict keys() etc.

If you're saying that you shouldn't be able to mutate the
underlying object *through* the view, that's okay -- I don't
mind if the views are read-only in some or all cases.

 > Let's make dicts as
> simple as possible and then introduce a new collections module entry with the 
> views bells and whistles. 

If the view methods are only available on a special dict
subclass and not on ordinary dicts, their usefulness will
be severely crippled, so you wouldn't learn much from
the experiment.


More information about the Python-3000 mailing list