[Python-3000] Iterators for dict keys, values, and items == annoying :)

Adam DePrince adam.deprince at gmail.com
Wed Mar 29 17:45:33 CEST 2006


> set interface where we could have a __container__/__view__/__set__

Why would I call a method to get a view on an object when the object can
just as well implement the view?  The *only* time we want to call a
method to get a view is when there is not one, single, completing
definition of the object's canonical perspective should be.  

List has a single obvious view.  If you really want to see a list as a
setview, just pretend it doesn't implement OrderedView and
CollectionView.  Down-casting by neglect works fine.  

Dict doesn't, there are 4 possiable views.  The mapping view provided
directly by the dict, and keys/values/items.  


- Adam DePrince




More information about the Python-3000 mailing list