On 9/11/2015 3:56 AM, Herbert Kruitbosch wrote:

I was wondering if there are considerations for including partial

function application syntactically. I very often find myself writing

statements as:

data_sorted = sort(data, key = lambda x: x[0])

where I would prefer

data_sorted = sort(data, key = #1[0])

where the #1 is similar to the one used in Mathematica for the same

purpose. That is, an expression with #1 becomes an anonymous function

which takes one argument, and, obviously, if a #n is included, the

anonymous function takes n arguments.

I was wondering if there are considerations for including partial

function application syntactically. I very often find myself writing

statements as:

data_sorted = sort(data, key = lambda x: x[0])

where I would prefer

data_sorted = sort(data, key = #1[0])

where the #1 is similar to the one used in Mathematica for the same

purpose. That is, an expression with #1 becomes an anonymous function

which takes one argument, and, obviously, if a #n is included, the

anonymous function takes n arguments.

For future reference, ideas like this belong on the python-list or

python-ideas list. Pydev is more for discussion of policy, concrete

issues for the next releases, and approval ideas that have been fully

fleshed out in the form of a PEP.

--

Terry Jan Reedy