On Tue, Jan 8, 2013 at 6:53 PM, Benjamin Peterson <benja...@python.org> wrote:
> 2013/1/8 Guido van Rossum <gu...@python.org>:
>> On Tue, Jan 8, 2013 at 6:07 PM, Benjamin Peterson <benja...@python.org> 
>> wrote:
>>> 2013/1/8 Yuriy Taraday <yorik....@gmail.com>:
>>>> 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"?
>>>
>>> I expect that's a copy-and-paste error. exception() will return the
>>> exception if one occured.
>>
>> I don't see the typo. It is as Nick explained.
>
> PEP 3156 says "exception(). Difference with PEP 3148: This has no
> timeout argument and does not wait; if the future is not yet done, it
> raises an exception." I assume it's not supposed to raise.

No, actually, in that case it *does* raise an exception, because it
means that the caller didn't understand the interface. It *returns* an
exception object when the Future is done but the "result" is
exceptional. But it *raises* when the Future is not done yet.

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to