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 dstufft
Recipients dstufft
Date 2013-08-24.19:08:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377371302.25.0.787358043575.issue18826@psf.upfronthosting.co.za>
In-reply-to
Content
I noticed today that the builtin reversed() requires an explicit sequence and won't work with an iterator instead it throws a TypeError like:

>>> reversed(x for x in [1, 2, 3])
TypeError: argument to reversed() must be a sequence

It would be really great if reversed() worked on iterators too. Currently it requires an explicit list() before you can sent it back into reversed() which seems like it hurts readability.

For what it's worth I discovered this when trying to reverse the output of itertools.dropwhile.
History
Date User Action Args
2013-08-24 19:08:22dstufftsetrecipients: + dstufft
2013-08-24 19:08:22dstufftsetmessageid: <1377371302.25.0.787358043575.issue18826@psf.upfronthosting.co.za>
2013-08-24 19:08:22dstufftlinkissue18826 messages
2013-08-24 19:08:22dstufftcreate