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 madison.may
Recipients dstufft, madison.may, rhettinger
Date 2013-08-25.01:53:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377395585.27.0.432662007885.issue18826@psf.upfronthosting.co.za>
In-reply-to
Content
Reversed doesn't make sense for all iterables.

>>> a = set([1, 2, 3])
>>> a = iter(a) # No error
>>> a = reversed(a) # Not typically desirable 

The point is that not all iterables are necessarily ordered.  And a reversed function shouldn't operate on unordered types.

Here's the relevant section of the docs for reversed():

reversed(seq)
    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).  

Your point about the sorted()'s behavior seems like a fair one, though. Perhaps it does make sense to support implicit conversion to lists for generator objects passed to reversed().
History
Date User Action Args
2013-08-25 01:53:05madison.maysetrecipients: + madison.may, rhettinger, dstufft
2013-08-25 01:53:05madison.maysetmessageid: <1377395585.27.0.432662007885.issue18826@psf.upfronthosting.co.za>
2013-08-25 01:53:05madison.maylinkissue18826 messages
2013-08-25 01:53:04madison.maycreate