<div dir="ltr"><div class="gmail_quote">On Thu, Apr 29, 2010 at 1:01 PM, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 29 April 2010 02:15, cool-RR <<a href="mailto:cool-rr@cool-rr.com">cool-rr@cool-rr.com</a>> wrote:<br>
> Though this leads me to another thought: Maybe we should have an argument to<br>
> `reversed` which will instruct it to make a list out of the iterable and<br>
> then return the `reversed` of that list, but only when the original iterable<br>
> is not naturally reversible. This way you could be sure that `reversed` will<br>
> work on any iterable. (When you don't care much about performance, of<br>
> course.)<br>
<br>
</div>def reversed_anything(a):<br>
    try:<br>
        return reversed(a)<br>
    except TypeError:<br>
        return reversed(list(a))<br>
<font color="#888888"><br>
Paul<br>
</font></blockquote></div><div><br></div>Yes, I'm aware the implementation is simple. I was not asking for an implementation. I was just raising the idea that it should be part of the builtin `reversed`. But since there are no +1s, I guess not.<div>
<br></div><div>Ram.<br>
</div></div>