Christopher Subich wrote:

> As others have mentioned, this looks too much like a list comprehension 
> to be elegant, which also rules out () and {}... but I really do like 
> the infix syntax.

Why would it rule out ()?

You need to put a lambda express in ()'s anyways if you want to use it 
right away.

      print (lambda x,y:x+y)(1,2)

If you don't use the ()'s it reads the y(1,2) as part of the lambda 
expression, might as well require the ()'s to start with rather than 
leave it open for a possible error.


You could even say () is to function as [] is to list.

a function :  name(args)  ->  returns a value

a list     :  name[index] ->  returns a value



My choice:

     name = (let x,y return x+y)   # easy for beginners to understand
     value = name(a,b)

     value = (let x,y return x+y)(a,b)



I think the association of (lambda) to [list_comp] is a nice 
distinction.  Maybe a {dictionary_comp} would make it a complete set. ;-)

Cheers,
Ron













-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to