even shorter:
def funcA(tarray):
s = min(len(tarray), 3)
return [2, 3, 4][0:s] + [e for e in funcB(3-s)[0:3-s]]
--
http://mail.python.org/mailman/listinfo/python-list
Marc 'BlackJack' Rintsch a écrit :
> On Tue, 23 Oct 2007 11:48:08 +0200, Loic Mahe wrote:
>
>> even shorter:
>>
>> def funcA(tarray):
>> s = min(len(tarray), 3)
>> return [2, 3, 4][0:s] + [e for e in funcB(3-s)[0:3-s]]
>
> Why the lis
Frank Samuelson a écrit :
> foo = function(x,y) x+y*2 # Example S language code
> bar = foo
> bar(3,4)
> m = lapply( s, foo )
> bb = lapply(s, function(t) t[3]*4 )
Here you want all functions to be lambda functions:
you can get something very close to what you want,
just like this:
foo = lambd
Chris M write :
> Multi-return value lambda? Just so you know, there is no concept of
> returning more than one value from a function.
I wrote:
> * multi return value lambda
I meant: multiple return statement, not return multiple values
pseudo code here:
lambda x: if A return B, if C return D,
gamename a écrit :
> Hi,
>
> In TCL, you can do things like:
> set foobar "HI!"
> set x foo
> set y bar
> subst $$x$y
> HI!
>
> Is there a way to do this type of evaluation in python?
>
> TIA,
> -T
>
you can also try using eval:
>>> foobar = "HI!"
>>> x = 'foo'
>>> y = 'bar'
>>> print eva
[EMAIL PROTECTED] a écrit :
> For those that understand algorithms and can talk Python, I want to
> convert the Python code in the section "Reading out all LCSs" into C++
> code but I don't understand some of the syntax. Can anyone give me a
> hand?
>
> def backTrackAll(C, X, Y, i, j):
> if i