Re: args (was Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?))

2005-01-07 Thread Bengt Richter
On Tue, 04 Jan 2005 14:11:51 -0800, Michael Spencer <[EMAIL PROTECTED]> wrote: [Hm, this didn't go out for some reason. I'll just send it now.] >Roman Suzi wrote: > >> Maybe this is too outlandish, but I see lambdas as a "quote" mechanism, >> which presents a possibility to postpone (precisely con

Re: Deferred expressions (was Re: Lambda as declarative idiom)

2005-01-06 Thread Nick Coghlan
Bengt Richter wrote: I like the fact that 'def' can serve as a mnemonic for 'defer' or 'deferred' ;-) Yeah, me too. I didn't actually notice that until after I'd thought of the phrase. OTOH, I like concise notation for expressions, and the def and from aren't really necessary if you can tag the fi

Re: Deferred expressions (was Re: Lambda as declarative idiom)

2005-01-05 Thread Bengt Richter
On Tue, 04 Jan 2005 19:31:37 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Steven Bethard wrote: >> Nick Coghlan: def-from syntax [4] >> (def f(a) + o(b) - o(c) from (a, b, c)) >> (def x * x from (x)) >> (def x from ()) >> (def x.bar(*a, **k) from (*a, **k)) >> ((def x(*a, **k) from ()) for x, a

Re: Lambda as declarative idiom

2005-01-04 Thread Jeff Shannon
Robert Brewer wrote: Michael Spencer wrote: I believe that this "possibility to postpone" divides into two related but separate concepts: controlling the moment of evaluation, and assembling the arguments required at that moment. They are both species of 'eval', but managing arguments is more sp

Re: args (was Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?))

2005-01-04 Thread Roman Suzi
On Tue, 4 Jan 2005, Michael Spencer wrote: >Roman Suzi wrote: > >> Maybe this is too outlandish, but I see lambdas as a "quote" mechanism, >> which presents a possibility to postpone (precisely control, delegate) >> evaluation. That is, an ovehead for lambda must be much lower but at the >> same t

Re: Lambda as declarative idiom

2005-01-04 Thread Robert Brewer
Michael Spencer wrote: > Roman Suzi wrote: > > > Maybe this is too outlandish, but I see lambdas as a > "quote" mechanism, > > which presents a possibility to postpone (precisely > control, delegate) > > evaluation. That is, an ovehead for lambda must be much > lower but at the > > same time vi

args (was Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?))

2005-01-04 Thread Michael Spencer
Roman Suzi wrote: Maybe this is too outlandish, but I see lambdas as a "quote" mechanism, which presents a possibility to postpone (precisely control, delegate) evaluation. That is, an ovehead for lambda must be much lower but at the same time visible to the programmer: d = a + (lambda x, y: x+ y)

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-04 Thread Roman Suzi
On Tue, 4 Jan 2005, Steven Bethard wrote: >Roman Suzi wrote: >> On Mon, 3 Jan 2005, Steven Bethard wrote: >> >> >>>Roman Suzi wrote: >>> I wish lambdas will not be deprecated in Python but the key to that is dropping the keyword (lambda). If anybody could think of a better syntax for l

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-04 Thread Steven Bethard
Roman Suzi wrote: On Mon, 3 Jan 2005, Steven Bethard wrote: Roman Suzi wrote: I wish lambdas will not be deprecated in Python but the key to that is dropping the keyword (lambda). If anybody could think of a better syntax for lambdas _with_ arguments, we could develop PEP 312 further. Some suggest

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-04 Thread Steven Bethard
Bengt Richter wrote: On Mon, 03 Jan 2005 18:54:06 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: Roman Suzi wrote: I wish lambdas will not be deprecated in Python but the key to that is dropping the keyword (lambda). If anybody could think of a better syntax for lambdas _with_ arguments, we could

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-04 Thread Roman Suzi
On Mon, 3 Jan 2005, Steven Bethard wrote: > Roman Suzi wrote: > > I wish lambdas will not be deprecated in Python but the key to that is > > dropping the keyword (lambda). If anybody could think of a better syntax for > > lambdas _with_ arguments, we could develop PEP 312 further. > > Some suggest

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-04 Thread Bengt Richter
On Mon, 03 Jan 2005 18:54:06 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: >Roman Suzi wrote: >> I wish lambdas will not be deprecated in Python but the key to that is >> dropping the keyword (lambda). If anybody could think of a better syntax for >> lambdas _with_ arguments, we could develop PEP

Deferred expressions (was Re: Lambda as declarative idiom)

2005-01-04 Thread Nick Coghlan
Steven Bethard wrote: Nick Coghlan: def-from syntax [4] (def f(a) + o(b) - o(c) from (a, b, c)) (def x * x from (x)) (def x from ()) (def x.bar(*a, **k) from (*a, **k)) ((def x(*a, **k) from ()) for x, a, k in funcs_and_args_list) After a bit more musing, this is definitely my preferred syntax. I'd

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-03 Thread Steven Bethard
Roman Suzi wrote: I wish lambdas will not be deprecated in Python but the key to that is dropping the keyword (lambda). If anybody could think of a better syntax for lambdas _with_ arguments, we could develop PEP 312 further. Some suggestions from recent lambda threads (I only considered the ones

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-03 Thread Dave Benjamin
Roman Suzi wrote: I wish lambdas will not be deprecated in Python but the key to that is dropping the keyword (lambda). If anybody could think of a better syntax for lambdas _with_ arguments, we could develop PEP 312 further. Well, my vote is still with Ruby-style codeblock syntax, but as a compro

Re: Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2005-01-03 Thread Roman Suzi
Hi all, BTW, Alex Martelli and me have created a PEP 312 some time ago (when the debate of inline if was hot). I wish lambdas will not be deprecated in Python but the key to that is dropping the keyword (lambda). If anybody could think of a better syntax for lambdas _with_ arguments, we could de

Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2004-12-31 Thread Robert Brewer
Steven Bethard wrote: > * Rewritable with existing functions > Mainly these are examples of code that can benefit from using the > functions available in the operator module, especially > operator.itemgetter and operator.attrgetter (available in 2.4) > ... > * Rewritable with list comprehensions/g