Opened 6 years ago

Closed 6 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 Mariusz Felisiak, 6 years ago

Component: Core (Other) → Utilities
Triage Stage: Unreviewed → Accepted

comment:2 by Diego Lima, 6 years ago

Owner: changed from nobody to Diego Lima
Status: new → assigned

comment:3 by Diego Lima, 6 years ago

Has patch: set

Submitted on PR 14089 ​https://github.com/django/django/pull/14089. Not sure if master is the right target branch. Please let me know if that's a mistake!

Last edited 6 years ago by Diego Lima (previous) (diff)

comment:4 by Diego Lima, 6 years ago

Cc: Diego Lima added

comment:5 by Chris Jerdonek, 6 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 Mariusz Felisiak, 6 years ago

Yes, I accepted assuming it'd be used in #32516. Sorry I should mention this.

comment:7 by Mariusz Felisiak, 6 years ago

Triage Stage: Accepted → Ready for checkin

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 6 years ago

Resolution: → fixed
Status: assigned → closed

In 2e5aa444:

Fixed #32517 -- Made OrderedSet reversible.

Refs #32516.

Note: See TracTickets for help on using tickets.
Back to Top