New submission from Antony Lee <anntzer....@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue44019>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to