Guido van Rossum wrote:

>> Note that some changes to the underlying object may invalidate the
>> view, in which case using it will throw an exception.
> 
> No, this only invalidates an in-progress iterator.

Yeah - that's what I meant - just couldn't think if there were any other
situations that might (at least with the standard views).

>> Note also that there is nothing preventing someone from creating a
>> view-like class that allows changing the underlying object through
>> it, but such a class should probably not be described as a view.
> 
> You can also think of dict views as a straightforward application of
> the GoF adapter pattern.

Yep - and I think that would be a good secondary explanation, instantly
understandable by anyone with much programming experience.

I think it's important though to set the expectations of what a view
will normally be used for, so that any unqualified use of the term
"view" will have a common understanding. And I think that the
unqualified "view" should mean read-only.

Tim Delaney
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to