<div dir="ltr"><div class="gmail_quote">On Wed, Apr 28, 2010 at 1:00 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 28 April 2010 11:48, cool-RR <<a href="mailto:cool-rr@cool-rr.com">cool-rr@cool-rr.com</a>> wrote:<br>
> Does anyone else care to express their opinion about the Reversable<br>
> suggestion?<br>
<br>
</div>I think you need some more convincing use cases, and a better<br>
explanation of how you'd see it working. As things stand, it sounds<br>
like you're just suggesting it for completeness' sake. I assume you're<br>
expecting an implementation which checks if the type is an instance of<br>
Sequence or has a callable attribute __reversed__?<br>
<br>
Then again, I'm not a great user of ABCs in any case - easier to ask<br>
forgiveness and all that, I'd tend to just use reversed() and be<br>
prepared to deal with an error if the caller passed something<br>
non-reversible (maybe just by expecting the caller to deal with the<br>
exception, because they didn't satisfy the input requirements).<br>
<font color="#888888"><br>
Paul.<br>
</font></blockquote></div><br>I agree with your criticisms. I was indeed offering it for completeness' sake, I think that when I needed it, I had some iterable that I didn't know if I could use `reversed` on.
<div><br></div><div>Though this leads me to another thought: Maybe we should have an argument to `reversed` which will instruct it to make a list out of the iterable and then return the `reversed` of that list, but only when the original iterable is not naturally reversible. This way you could be sure that `reversed` will work on any iterable. (When you don't care much about performance, of course.)</div>
<div><br></div><div>Ram.</div></div>