Re: Special keyword argument lambda syntax

2009-03-14 Thread Nick Craig-Wood
Beni Cherniavsky beni.cherniav...@gmail.com wrote: This proposal outrageously suggests a special syntax for in-line functions passed as keyword arguments:: sorted(range(9), key(n)=n%3) [0, 3, 6, 1, 4, 7, 2, 5, 8] The claim is that such specialization hits a syntax sweet

Re: Special keyword argument lambda syntax

2009-03-14 Thread Beni Cherniavsky
On Mar 14, 5:30 pm, Nick Craig-Wood n...@craig-wood.com wrote: BeniCherniavskybeni.cherniav...@gmail.com wrote:  This proposal outrageously suggests a special syntax for in-line  functions passed as keyword arguments::       sorted(range(9), key(n)=n%3)      [0, 3, 6, 1, 4, 7, 2, 5, 8]

Re: Special keyword argument lambda syntax

2009-03-14 Thread Rhodri James
On Fri, 13 Mar 2009 16:39:16 -, Scott David Daniels scott.dani...@acm.org wrote: The original proposal was initially appealing to me until I saw this comment. That means a relatively invisible typo would turn into good syntax. Possibley this is exactly what Rhodri James is talking

Re: Special keyword argument lambda syntax

2009-03-14 Thread Rhodri James
On Fri, 13 Mar 2009 15:33:26 -, MRAB goo...@mrabarnett.plus.com wrote: Rhodri James wrote: On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky beni.cherniav...@gmail.com wrote: Specification = Allow keyword arguments in function call to take this form: NAME (

Special keyword argument lambda syntax

2009-03-13 Thread Beni Cherniavsky
This proposal (a) ignores Guido's clear-cut decision that lambda is good as it is, (b) is weird in proposing a special-case syntax, (c) is several Python versions too late for a graceful transition by 3.0. But I don't won't to just throw the idea away, so I'm posting here. If there is serious

Re: Special keyword argument lambda syntax

2009-03-13 Thread Rhodri James
On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky beni.cherniav...@gmail.com wrote: Specification = Allow keyword arguments in function call to take this form: NAME ( ARGUMENTS ) = EXPRESSION which is equivallent to the following: NAME = lambda ARGUMENTS:

Re: Special keyword argument lambda syntax

2009-03-13 Thread MRAB
Rhodri James wrote: On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky beni.cherniav...@gmail.com wrote: Specification = Allow keyword arguments in function call to take this form: NAME ( ARGUMENTS ) = EXPRESSION which is equivallent to the following: NAME = lambda

Re: Special keyword argument lambda syntax

2009-03-13 Thread Scott David Daniels
Rhodri James wrote: On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky beni.cherniav...@gmail.com wrote: ...Allow keyword arguments in function call to take this form: NAME ( ARGUMENTS ) = EXPRESSION which is equivallent to the following: NAME = lambda ARGUMENTS: EXPRESSION except

Re: Special keyword argument lambda syntax

2009-03-13 Thread Hrvoje Niksic
MRAB goo...@mrabarnett.plus.com writes: sorted(range(9), def key(n): n % 3) [0, 3, 6, 1, 4, 7, 2, 5, 8] Given the recent pattern of syntactic constructs for expressions using expr keyword expr (ternary if, listcomps, genexps), and avoiding the use of colon in expressions, maybe it should be:

Re: Special keyword argument lambda syntax

2009-03-13 Thread MRAB
Hrvoje Niksic wrote: MRAB goo...@mrabarnett.plus.com writes: sorted(range(9), def key(n): n % 3) [0, 3, 6, 1, 4, 7, 2, 5, 8] Given the recent pattern of syntactic constructs for expressions using expr keyword expr (ternary if, listcomps, genexps), and avoiding the use of colon in

Re: Special keyword argument lambda syntax

2009-03-13 Thread bearophileHUGS
MRAB:   sorted(range(9), def key(n): n % 3) I am fine with the current lambda syntax, but another possibility: sorted(range(9), n = n % 3) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list