[Python-Dev] any support for a methodcaller HOF? (original) (raw)

Georg Brandl g.brandl at gmx.net
Fri Feb 3 18:31:00 CET 2006


Alex Martelli wrote:

A class I wrote (and lost) ages ago was a "placeholder" class, so if 'X' was an instance of this class, "X + 1" was roughly equivalent to "lambda x:x+1" and "X.method(zip, zop)" was roughly equivalent to your "methodcaller("method", zip, zop)". I threw it away when listcomps got implemented. Not sure why I mention it now, something about your post made me think of it... Such a placeholder would certainly offer better syntax and more power than methodcaller (and itemgetter and attrgetter, too). A lovely idea!

Yep. And it would make Python stand out of the crowd another time ;)

The question is: is it "serious" and deterministic enough to be builtin?

Georg



More information about the Python-Dev mailing list