Python reversed() built-in function

From the Python 3 documentation

Return a reverse iterator. seq must be an object which has a __reversed__() method or supports the sequence protocol (the __len__() method and the __getitem__() method with integer arguments starting at 0).


>>> i = reversed([1, 2, 3])
>>> i.__next__()
# 3
>>> i.__next__()
# 2
>>> i.__next__()
# 1
>>> i
# <list_reverseiterator object at 0x7f93159ded00>

Ups! Nothing here yet!

This is a great opportunity for you to collaborate! Hit the link at the end of this page and add some examples and a brief description. If you don't know where to start, the Python 3 documentation will lead you in the right direction.

Subscribe to

Join 10.900+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.