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.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to