Add __reversed__ support to keys, values, and items views#1304
Open
r266-tech wants to merge 1 commit intoaio-libs:masterfrom
Open
Add __reversed__ support to keys, values, and items views#1304r266-tech wants to merge 1 commit intoaio-libs:masterfrom
r266-tech wants to merge 1 commit intoaio-libs:masterfrom
Conversation
Implement the method for _KeysView, _ValuesView, and _ItemsView, allowing reversed() iteration over multidict views. Also adds iter_entries_reverse() to _HtKeys for reverse entry traversal. Closes aio-libs#448
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1304 +/- ##
==========================================
- Coverage 99.85% 99.40% -0.46%
==========================================
Files 26 26
Lines 3513 3536 +23
Branches 253 259 +6
==========================================
+ Hits 3508 3515 +7
- Misses 3 19 +16
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Vizonex
reviewed
Mar 23, 2026
Member
Vizonex
left a comment
There was a problem hiding this comment.
I would recommend you add a C Implementation and not just a Python One. This is because most users will end up with compiled binaries and multidict will default to the C Module if found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the
__reversed__method for_KeysView,_ValuesView, and_ItemsView, allowingreversed()iteration over multidict views.Since Python 3.8, built-in
dictviews supportreversed(). This PR brings multidict views to parity.Closes #448.
Changes
iter_entries_reverse()to_HtKeysfor reverse entry traversal__reversed__and_iter_reversedto_KeysView,_ValuesView, and_ItemsViewreversed()Example