A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-February/085868.html below:

[Python-Dev] Missing operator.call

[Python-Dev] Missing operator.call [Python-Dev] Missing operator.callAndrew Bennetts andrew-pythondev at puzzling.org
Wed Feb 4 14:28:21 CET 2009
Hrvoje Niksic wrote:
> Is there a reason why the operator module doesn't have an operator.call  
> function?

Python 2.6 adds operator.methodcaller.  So you could use
operator.methodcaller('__call__'), but that's not really any better than
lambda x: x().

A patch to add operator.caller(*args, **kwargs) may be a good idea.  Your
example would then be:

    map(operator.caller(), lst)

That reads ok to me.  I think this reads better though:

    [callable() for callable in lst]

<wink>

-Andrew.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4