New submission from Donald Stufft: 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. ---------- messages: 196090 nosy: dstufft priority: normal severity: normal status: open title: reversed() requires a sequence - Could work on any iterator? _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18826> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com