<div dir="ltr"><div class="gmail_quote">On Thu, Jun 7, 2012 at 1:50 PM, Stephen J. Turnbull <span dir="ltr"><<a href="mailto:stephen@xemacs.org" target="_blank">stephen@xemacs.org</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">   def search_in_iterable(key, iter):</div>
        for item in iter:<br>
            if item == key:<br>
                return some_function_of(item)<br>
        else:<br>
            return not_found_default<br>
<br>
</blockquote></div><br><div>You don't need the "else" there. An equivalent:</div><div><br></div><div><div>    def search_in_iterable(key, iter):</div><div>       for item in iter:</div><div>           if item == key:</div>
<div>               return some_function_of(item)</div><div>       return not_found_default</div></div><div><br></div><div><br></div><div>I'm not sure I understood what you meant but I'll assume that by "plausible"/"reasonable" you meant that it's a good example as to how for/else is misleading.</div>
<div><br></div><div>Devin Jeanpierre Wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style>Also, are you worried about people that read the documentation and<br>
</span><span style>know what for-else does, or the people that don't or haven't read this<br></span><span style>documentation? </span></blockquote><div><br></div><div>On this issue I'm worried about all sentient programmers.</div>
<div><br></div><div>Yuval</div><div><br></div></div>