A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-January/123533.html below:

[Python-Dev] PEP 3156 - Asynchronous IO Support Rebooted

[Python-Dev] PEP 3156 - Asynchronous IO Support RebootedNick Coghlan ncoghlan at gmail.com
Wed Jan 9 03:31:04 CET 2013
On Wed, Jan 9, 2013 at 11:14 AM, Yuriy Taraday <yorik.sar at gmail.com> wrote:
> 4. Why separate exception() from result() for Future class? It does the same
> as result() but with different interface (return instead of raise). Doesn't
> this violate the rule "There should be one obvious way to do it"?

The exception() method exists for the same reason that we support both
"key in mapping" and raising KeyError from "mapping[key]": sometimes
you want "Look Before You Leap", other times you want to let the
exception fly. If you want the latter, just call .result() directly,
if you want the former, check .exception() first.

Regardless, the Future API isn't really being defined in PEP 3156, as
it is mostly inheritied from the previously implemented PEP 3148
(http://www.python.org/dev/peps/pep-3148/#future-objects)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4