[Python-ideas] [Python-Dev] PEP 3156 - Asynchronous IO Support Rebooted (original) (raw)

Richard Oudkerk shibturn at gmail.com
Wed Jan 9 11:28:42 CET 2013


On 09/01/2013 2:31am, Nick Coghlan wrote:

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.

But how can you do LBYL. I can't see a way to check that an exception has occurred seeing whether result() raises an error: done() tells you that the operation is finished, but not whether it succeeded.

-- Richard



More information about the Python-ideas mailing list