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

Bengt Richter bokr at oz.net
Mon Feb 6 00:28:55 CET 2006


On Sun, 05 Feb 2006 18:45:52 GMT, bokr at oz.net (Bengt Richter) wrote: [...]

Psst, Nick, how about (x*y for x,y in ()) ? # "()" as mnemonic for call args D'oh, sorry, that should have been illegal syntax, e.g.,

 (x*y for x,y in *) ? # "*" as mnemonic for call *args

so (x*y for x,y in )(3,5) # => 15 or (xy for x,y in )([3,5]) # => 15 etc.

Hm, along that line why not

 (x*y for x,y in **) ? # "**" as mnemonic for call **kwargs

so (x*y for x,y in **)(x=3, y=5) # => 15 or maybe even (x*y+z for (x,y),z in *,**)(3, 5, z=200) # => 215

Though I see this is moot, since Guido decided to "keep lambda," (+1 on that, although this is kind of growing on me, no doubt from partial ih-factor ;-)

Regards, Bengt Richter



More information about the Python-Dev mailing list