[New-bugs-announce] [issue37770] reversed class should implement __reversed__

Jason Curtis report at bugs.python.org
Mon Aug 5 18:40:03 EDT 2019


New submission from Jason Curtis <thatneat at gmail.com>:

I've just been trying to implement some logic which potentially involves reversing things back to their initial orders, and it'd be nice to just be able to call reversed() on something that has already been reversed.

>>> reversed(reversed([1,2,3,4]))
TypeError: 'list_reverseiterator' object is not reversible

Seems like this should be trivial to implement by just returning the initial iterator.

Happy to post a pull request if it would be considered.

----------
components: Library (Lib)
messages: 349085
nosy: jason.curtis
priority: normal
severity: normal
status: open
title: reversed class should implement __reversed__
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37770>
_______________________________________


More information about the New-bugs-announce mailing list