[Python-ideas] Lambda again: unnamed arguments

Giovanni Bajo rasky at develer.com
Thu Mar 27 12:25:41 CET 2008


Hello,

inspired by Greg's post about ideas on making the lambda syntax more 
concise, like:

    x,y => x+y

I was wondering if using unnamed arguments had already been debated. 
Something like:

    \(_1+_2)

where basically you're declaring implicitally declaring that your lambda 
takes two arguments. You wouldn't be able to call them through keyword 
arguments, nor to accept a variable number of arguments (nor to accept 
more arguments than they are actually used), but wouldn't it cover most 
use cases and be really compact?

Other examples:

     k.sort(key=\(_1.foo))
     k.sort(key=\(_1[0]))

-- 
Giovanni Bajo




More information about the Python-ideas mailing list