Opened 5 years ago
Closed 5 years ago
#32517 closed New feature (fixed)
Allow calling reversed() on an OrderedSet
| Reported by: | Chris Jerdonek | Owned by: | Diego Lima |
|---|---|---|---|
| Component: | Utilities | Version: | 4.0 |
| Severity: | Normal | Keywords: | OrderedSet, reversed |
| Cc: | Diego Lima | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
Currently, OrderedSet isn't reversible (i.e. allowed to be passed as an argument to Python's reversed()). This would be natural to support given that OrderedSet is ordered. This should be straightforward to add by adding a __reversed__() method to OrderedSet.
Change History (8)
comment:1 by , 5 years ago
| Component: | Core (Other) → Utilities |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:4 by , 5 years ago
| Cc: | added |
|---|
comment:5 by , 5 years ago
Since Simon asked in the PR comments, I'll state the reason for this feature. It would be useful for resolving #32516, which involves reversing a number of OrderedSet objects.
comment:6 by , 5 years ago
Yes, I accepted assuming it'd be used in #32516. Sorry I should mention this.
comment:7 by , 5 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Submitted on PR 14089 https://github.com/django/django/pull/14089.