Shelve types in Python 2.7 don't implement the 'viewkeys', 'viewvalues', and 'viewitems' methods. Section 11.4 of the Python Standard Library documentation says that "Shelf objects support all methods supported by dictionaries." If those methods can't be added to shelves, the documentation should be clarified. The use case for this was that I wanted an iterator on a shelf that didn't try to materialize the entire list (since the shelf is very large and I'd prefer to leave most of it on disk).
Attached is a patch that adds documentation to `shelve.rst` explicitly stating that it does not support the viewkeys, viewvalues, and viewitems methods. I think this is the correct approach since it doesn't seems sensible to add support for these methods to UserDict, *and* also it might give users the impression that they can incrementally iterate over a shelved object without loading it all (which I believe is incorrect).
Attached is a patch that adds a sentence to the UserDict module docs explicitly stating that the viewkeys, viewitems, and viewvalues functions are not implemented. I don't think it's worth adding support for these newer functions in UserDict. I'm unsure whether landing this patch is as necessary as the patch for the shelve module.