[Python-ideas] Lambda again: unnamed arguments

Brett Cannon brett at python.org
Thu Mar 27 19:17:21 CET 2008

On Thu, Mar 27, 2008 at 4:25 AM, Giovanni Bajo <rasky at develer.com> wrote:
> 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]))

Two reasons for being -1:

One is it's just plain ugly to me.

Two, why break from how functions and methods work to save a few
keystrokes? Explicit is better than implicit.


More information about the Python-ideas mailing list