Visitar URL original
DOC: add_done_callback - callback is called with Future as the LAST non-keyword argument, rather than the first/only argument · Issue #113635 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250610080230/https://github.com/python/cpython/issues/113635
Skip to content

DOC: add_done_callback - callback is called with Future as the LAST non-keyword argument, rather than the first/only argument #113635

Closed as not planned
@Ennovate-com

Description

@Ennovate-com

Documentation

In (A) Future Object add_done_callback(callback, *, context=None) it says The callback is called with the Future object as its only argument. It also says functools.partial() can be used to pass parameters to the callback.

However, (B) functools.partial(func, /, *args, **keywords) says If more [non-keyword] arguments are supplied to the call, they are appended to args.

When I call add_done_callback(functools.partial(done_callback, *args, **kwargs)), what appears to be happening is what is described by (B) rather than (A). In other words:

functools.partial() can be used to pass additional parameters to the callback. The callback is called with the Future object as the last (possibly only) non-keyword argument (rather than its first/"only" argument).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions