Re: combining several lambda equations

2005-02-21 Thread Steven Bethard
Antoon Pardon wrote: So and if I have code like this: f = lamda x:x for g in some_iter: f = compose(g,f) Do you still think that one should use a named function in this case? Yes. If you really don't like taking two lines, Python still allows you to write this as: def f(x): return x

Re: combining several lambda equations

2005-02-21 Thread Antoon Pardon
Op 2005-02-18, Steven Bethard schreef <[EMAIL PROTECTED]>: > Paddy McCarthy wrote: >> x=lambda : A < B >> y=lambda : C+6 >= 7 >> > [snip] >> >> Z=lambda : (A=7) > > See "Inappropriate use of Lambda" in > http://www.python.org/moin/DubiousPython > > Perhaps your real example is different, but notice

Re: combining several lambda equations

2005-02-18 Thread Paddy
Steve, Thanks for the info but I do know about that.. What I am doing is taking a set of inputted functions that don't take arguments and programmatically analysing them and combining them to create new functions that are further analysed. During testing I keep the numbers low, and am only dealing

Re: combining several lambda equations

2005-02-18 Thread Steven Bethard
Paddy McCarthy wrote: x=lambda : A < B y=lambda : C+6 >= 7 [snip] Z=lambda : (A=7) See "Inappropriate use of Lambda" in http://www.python.org/moin/DubiousPython Perhaps your real example is different, but notice that = lambda : is equivalent to def (): return except that the latt

Re: combining several lambda equations

2005-02-18 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I actually have a set of lambdas so my use will be more like: A set of lambdas gains you nothing. >>> (lambda: a > 0) in set([lambda: a > 0]) False is probably not what you expected. So you might want to go back to strings containing expressions. Anyway, here is a way

Re: combining several lambda equations

2005-02-18 Thread paddy3118
Fredrik Lundh wrote: > Paddy McCarthy wrote: > > > #If given:two or more lambda equations > > x=lambda : A < B > > y=lambda : C+6 >= 7 > > > > How do I create another lambda expression Z equivalent to > > > > Z=lambda : (A=7) > > > > # i.e. the anding together of the originals, but without referenc

Re: combining several lambda equations

2005-02-18 Thread Fredrik Lundh
Paddy McCarthy wrote: > #If given:two or more lambda equations > x=lambda : A < B > y=lambda : C+6 >= 7 > > How do I create another lambda expression Z equivalent to > > Z=lambda : (A=7) > > # i.e. the anding together of the originals, but without referencing > # globals x and y as they are artifi

combining several lambda equations

2005-02-18 Thread Paddy McCarthy
Hi, I am trying to use eval as little as possible but solve this problem. #If given:two or more lambda equations x=lambda : A < B y=lambda : C+6 >= 7 ... How do I create another lambda expression Z equivalent to Z=lambda : (A=7) # i.e. the anding together of the originals, but without referenc