<div dir="ltr">I suggest changing the following paragraph as annotated (from <a href="http://docs.python.org/2/tutorial/errors.html">http://docs.python.org/2/tutorial/errors.html</a>):<br><div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
The use of the else clause is better than adding additional code to the try clause because <u><b>the else clause is excluded from the try's protection. This</b></u> [was "it"] avoids accidentally catching an exception that wasn’t raised by the code <u><b>that is intended to be</b></u> [was "being"] protected by the try ... except statement." I suggest augmenting this either with more text or with an example.<br>
</blockquote><br>I initially could not decipher this.<br></div><br>I love the docs! Cheers,<br>Randy Sage<br><br></div><div>PS Original (verbose) email follows in case it is useful - but no need to read it. I decided that anybody who succeeds at such concise documentation deserves a better effort on my part.<br>
</div><div><br>===================================<br><br>First, I love the docs! They are the main reason I'm increasingly moving my work into Python, currently abandoning ruby/rails, but also migrating away from MATLAB and bash scripts.<br>
<br>After I read the tutorial on exceptions (<a href="http://docs.python.org/2/tutorial/errors.html">http://docs.python.org/2/tutorial/errors.html</a>), I went looking for a better explanation of:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
The use of the else clause is better than adding additional code to the try clause because it avoids accidentally catching an exception that wasn’t raised by the code being protected by the try ... except statement." I suggest augmenting this either with more text or with an example.<br>
</blockquote><br>The supplementary description at <a href="http://stackoverflow.com/a/855764/527489">http://stackoverflow.com/a/855764/527489</a> was perfect for me, but is more verbose than typical python docs, which I usuallyl find to be about as concise as possible - but no more so. <br>
<br>In this case, I think the issue is that the docs are too concise for those new to the concept, albeit I now see that they are perfect if you know (at least approximately) what that the try/except's else is for. I'm not great at being concise myself (sorry about the long email), but perhaps something like this:<br>
<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">The use of the else clause is better than adding additional code to the try clause because <u><b>the else clause is excluded from the try's protection. This</b></u> [was "it"] avoids accidentally catching an exception that wasn’t raised by the code <u><b>that is intended to be</b></u> [was "being"] protected by the try ... except statement." I suggest augmenting this either with more text or with an example.</blockquote>
<br>Thanks,<br>Randy Sage<br><br><br></div></div>