Closed as not planned
Description
Feature or enhancement
Proposal:
Currently, the reversed function doesn't support enumerate objects. This would be useful any time you want to traverse a list backwards whilst keeping indexes.
The implementation would ensure that enumerate objects support reversal only if the iterable argument also supports reversal and len.
lst = ["foo", "bar"]
for i, data in reversed(enumerate(lst)):
print(i, data)Currently, what I see being done is something like:
for i in range(len(lst)-1, -1, -1):
data = lst[i]Which is less readable.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response