Re: function expression with 2 arguments

2005-03-06 Thread Simon Percivall
Actually, lambda forms are quite precisely documented at http://docs.python.org/ref/lambdas.html if you feel than reading the tutorial (specifically http://docs.python.org/tut/node6.html section 4.7.5) is too base for you. -- http://mail.python.org/mailman/listinfo/python-list

Re: function expression with 2 arguments

2005-03-06 Thread Leif K-Brooks
Xah Lee wrote: if i understand correctly, forms such as (lambda x,y:x+y)(a,b) can only be gained thru experience? and not documented directly anywhere in the official docs? The official documentation can't list every possible permutation of the various syntactic constructs. It does explain parenth

Re: function expression with 2 arguments

2005-03-06 Thread Xah Lee
if i understand correctly, forms such as (lambda x,y:x+y)(a,b) can only be gained thru experience? and not documented directly anywhere in the official docs? Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: function expression with 2 arguments

2005-03-03 Thread Steve Holden
Xah Lee wrote: PS sorry for the rude remarks out of nowhere. Xah Wow, signs of developing inter-personal skills. I must assume that c.l.py is having its benign influence on you too! regards Steve -- Meet the Python developers and your c.l.py favorites March 23-25 Come to PyCon DC 2005

Re: function expression with 2 arguments

2005-03-03 Thread Xah Lee
PS sorry for the rude remarks out of nowhere. Xah -- http://mail.python.org/mailman/listinfo/python-list

Re: function expression with 2 arguments

2005-03-03 Thread Peter Hansen
Xah Lee wrote: Roel Schroeven wrote: (lambda x, y: x+y)(a, b) Thanks. That's what i was looking for. where in Pytho doc can one find this? or the lambda with multiple params? Most often the lambda is not used directly, but passed to a function. That is because the IT morons has been throughly brain

Re: function expression with 2 arguments

2005-03-03 Thread Xah Lee
Roel Schroeven wrote: > (lambda x, y: x+y)(a, b) Thanks. That's what i was looking for. where in Pytho doc can one find this? or the lambda with multiple params? > Most often the lambda is not used directly, but passed to a function. That is because the IT morons has been throughly brainwashe

Re: function expression with 2 arguments

2005-03-02 Thread Roel Schroeven
Xah Lee wrote: > once i have a expresson of a function, how to apply it to arguments? > > e.g. if i have > lambda x,y:x+y > i have to applied it to a,b in my code. OK, I'll bite. As with any other callable, you can simply call it like this: a = 4 b = 24 (lambda x, y: x+y)(a, b) Of course, you

Re: function expression with 2 arguments

2005-03-02 Thread Xah Lee
once i have a expresson of a function, how to apply it to arguments? e.g. if i have lambda x,y:x+y i have to applied it to a,b in my code. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: function expression with 2 arguments

2005-02-27 Thread Harlin Seritt
? -- http://mail.python.org/mailman/listinfo/python-list

Re: function expression with 2 arguments

2005-02-26 Thread Nick Coghlan
Xah Lee wrote: Python doc is quite confounded in it's way of organization centered around implementation tied to hardware (as most imperative languages are hardware-centric), as opposed to algorithm math concepts. Actually, Python's docs are centred around the fact that they expect people to start

Re: function expression with 2 arguments

2005-02-26 Thread Leif K-Brooks
Xah Lee wrote: lambda x, y: x + y that's what i was looking for. ... once i have a lambda expr, how to apply it to arguments? http://python.org/doc/current/ref/calls.html -- http://mail.python.org/mailman/listinfo/python-list

Re: function expression with 2 arguments

2005-02-26 Thread Xah Lee
lambda x, y: x + y that's what i was looking for. ... once i have a lambda expr, how to apply it to arguments? e.g. in Mathematica Function[#1+#2][a,b] Python doc is quite confounded in it's way of organization centered around implementation tied to hardware (as most imperative languages are ha

Re: function expression with 2 arguments

2005-02-26 Thread Peter Hansen
Xah Lee wrote: is there a way to write a expression of a function with more than 1 argument? e.g., i want a expression that's equivalent to def f(x,y) return x+y Since assignment is a statement in Python, not an expression, and since "def f" is an assignment that binds a function object to the na

Re: function expression with 2 arguments

2005-02-26 Thread Reinhold Birkenfeld
Xah Lee wrote: > is there a way to write a expression of a function with more than 1 > argument? > > e.g., i want a expression that's equivalent to > > def f(x,y) > return x+y Looking for lambda? Reinhold -- http://mail.python.org/mailman/listinfo/python-list

Re: function expression with 2 arguments

2005-02-26 Thread Harlin Seritt
Not exactly sure what you're looking for but you can do the following: def dosomething(numlist): return numlist[0] + numlist[1] numlist = [ 5, 10] val = dosomething(numlist) If so, that would be somewhat pointless. It's always best to keep it simple. It looks like the function you wrote above

function expression with 2 arguments

2005-02-26 Thread Xah Lee
is there a way to write a expression of a function with more than 1 argument? e.g., i want a expression that's equivalent to def f(x,y) return x+y Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list