[Python-3000] Thoughts on dictionary views

Larry Hastings larry at hastings.org
Wed Feb 21 01:51:16 CET 2007

Delaney, Timothy (Tim) wrote:
> A view is a lightweight object that implements an interface by
> delegating to an underlying object. The underlying object cannot be
> changed through the view, but could be changed directly, in which case
> the view will reflect the new contents of the object.
It certainly makes sense that views would *usually* be read-only, but is 
that really a *requirement*?  attrview(), recently discussed in 
Python-Dev, allowed changing the underlying object. See Martin v. 
Lowis's implementation of attrview() here:
It allowed setting attributes on the underlying object, like this:
    attrview(self)[method_name] = attrview(self.metadata)[method_name]



More information about the Python-3000 mailing list