This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yegle
Recipients yegle
Date 2017-11-17.23:11:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510960272.2.0.213398074469.issue32065@psf.upfronthosting.co.za>
In-reply-to
Content
This also affects xrange in Python2, so I chose the affected version as python27.

range object (and xrange in Python2) has __len__(), but the range_iterator object created from __reversed__() doesn't have __len__.

Python2:
>>> x = xrange(10)
>>> len(x)
10
>>> reversed(x)
<rangeiterator object at 0x7f86065684e0>
>>> y = reversed(x)
>>> len(y)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object of type 'rangeiterator' has no len()

Python3.6
>>> x = range(10)
>>> len(x)
10
>>> len(reversed(x))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object of type 'range_iterator' has no len()
History
Date User Action Args
2017-11-17 23:11:12yeglesetrecipients: + yegle
2017-11-17 23:11:12yeglesetmessageid: <1510960272.2.0.213398074469.issue32065@psf.upfronthosting.co.za>
2017-11-17 23:11:12yeglelinkissue32065 messages
2017-11-17 23:11:12yeglecreate