[Python-Dev] Missing operator.call

Hrvoje Niksic hrvoje.niksic at avl.com
Wed Feb 4 14:35:58 CET 2009


Andrew Bennetts wrote:
> A patch to add operator.caller(*args, **kwargs) may be a good idea.  Your
> example would then be:
> 
>     map(operator.caller(), lst)

Regarding the name, note that I proposed operator.call (and 
operator.__call__) because it corresponds to the __call__ special 
method, which is analogous to how operator.neg corresponds to __neg__, 
operator.add to __add__, etc.  The term "caller" implies creation of a 
new object that carries additional state, such as method name in 
operator.methodcaller, item in operator.itemgetter, or attr in 
operator.attrgetter.


More information about the Python-Dev mailing list