Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Question: what's the morale behind having a asyncio.Future? #490

@yangvz

Description

@yangvz

It seems that asyncio.Future is quite different from concurrent.futures.Future, for example, in terms of how cancellation works:

asyncio.Future.cancel()
Cancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future’s state to cancelled, schedule the callbacks and return True.

concurrent.futures.Future.cancel()
Attempt to cancel the call. If the call is currently being executed and cannot be cancelled then the method will return False, otherwise the call will be cancelled and the method will return True.

A concurrent future is "future" in the sense that it's return time is arbitrary, which is not the case for async tasks, whose return time is deterministic relative to the code with access to the task object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions