<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 9, 2013 at 6:31 AM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br>

<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"><div class="im">On Wed, Jan 9, 2013 at 11:14 AM, Yuriy Taraday <<a href="mailto:yorik.sar@gmail.com">yorik.sar@gmail.com</a>> wrote:<br>


> 4. Why separate exception() from result() for Future class? It does the same<br>
> as result() but with different interface (return instead of raise). Doesn't<br>
> this violate the rule "There should be one obvious way to do it"?<br>
<br>
</div>The exception() method exists for the same reason that we support both<br>
"key in mapping" and raising KeyError from "mapping[key]": sometimes<br>
you want "Look Before You Leap", other times you want to let the<br>
exception fly. If you want the latter, just call .result() directly,<br>
if you want the former, check .exception() first.<br></blockquote><div> </div><div style>Ok, I get it now. Thank you for clarifying.</div><div> </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">


Regardless, the Future API isn't really being defined in PEP 3156, as<br>
it is mostly inheritied from the previously implemented PEP 3148<br>
(<a href="http://www.python.org/dev/peps/pep-3148/#future-objects" target="_blank">http://www.python.org/dev/peps/pep-3148/#future-objects</a>)<br></blockquote><div><br></div><div style>Then #3 and #4 are about PEP 3148. Why was it done this way?</div>

<br><div><div>Kind regards, Yuriy. </div></div></div></div></div>