[New-bugs-announce] [issue44019] operator.call/operator.__call__

Antony Lee report at bugs.python.org
Mon May 3 10:24:00 EDT 2021


New submission from Antony Lee <anntzer.lee at gmail.com>:

Adding a call/__call__ function to the operator module (where `operator.call(*args, **kwargs)(func) == func(*args, **kwargs)`, similarly to operator.methodcaller) seems consistent with the design with the rest of the operator module.

An actual use case I had for such an operator was collecting a bunch of callables in a list and wanting to dispatch them to concurrent.futures.Executor.map, i.e. something like `executor.map(operator.call, funcs)` (to get the parallelized version of `[func() for func in funcs]`).

----------
components: Library (Lib)
messages: 392809
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: operator.call/operator.__call__
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44019>
_______________________________________


More information about the New-bugs-announce mailing list