-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dictviews methods not present on shelve objects #70744
Comments
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). |
The shelve object inherits its dict-like methods from UserDict.DictMixin. The documentation for UserDict.DictMixin should be updated too. |
Attached is a patch that adds documentation to 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). |
This patch looks fine. |
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. |
New changeset 2b4bfef0d54a by Raymond Hettinger in branch '2.7': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: