Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-25 Thread Terry Hancock
On Saturday 23 April 2005 02:43 am, Mage wrote: > Scott David Daniels wrote: > > See, the body of your anonymous function just looks for "the current > > value of n" when it is _invoked_, not when it is _defined_. > > The "lambda functions" was an unclear part of the tutorial I read. > Should I us

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread Bengt Richter
On 22 Apr 2005 20:45:55 -0700, "El Pitonero" <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> I still don't know what you are asking for, but here is a toy, >> ... >> But why not spend some time with the tutorials, so have a few more >cards in your deck >> before you try to play for real? ;-) >

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread Scott David Daniels
Mage wrote: Scott David Daniels wrote: See, the body of your anonymous function just looks for "the current value of n" when it is _invoked_, not when it is _defined_. The "lambda functions" was an unclear part of the tutorial I read. Should I use them? Are they pythonic? As far I see they are good

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread Harald Massa
Mage <[EMAIL PROTECTED]> wrote in news:mailman.2339.1114242211.1799.python- > The "lambda functions" was an unclear part of the tutorial I read. > Should I use them? Are they pythonic? > As far I see they are good only for type less a bit. And to obfusicate code. lambda is evil, do not play with

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread tiissa
[EMAIL PROTECTED] wrote: i wonder if there is an automatic way to make that without calling a function. You mean without _explicitely_ calling a function. May I inquire why you need to write f instead of f(x)? an automatic way that depends on changing the value of x. as each time x=something used t

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread Mage
Scott David Daniels wrote: > > > See, the body of your anonymous function just looks for "the current > value of n" when it is _invoked_, not when it is _defined_. The "lambda functions" was an unclear part of the tutorial I read. Should I use them? Are they pythonic? As far I see they are good o

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread Bengt Richter
On 22 Apr 2005 15:18:53 -0700, [EMAIL PROTECTED] wrote: >Thanx for your replies. > >I'm looking for array of functions. >Something like a=[ sin(x) , cos(x) ] > x=0.0 a >[0, 1] x=1.0 a >... > >of course it can be made by def cratearray(x): >... >...

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-23 Thread mehmetmutigozel
Thanx. It just popped in my mind. in 3d programming there are transformation matrices like a=[[cos(x),sin(x),0],[-sin(x),cos(x),0],[0,0,1]] it is a 3x3 matrix. never changes during program. it can be defined like >>> def transmat(x): ... dummy=[[0,0,0],[0,0,0],[0,0,0]] ... d

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-22 Thread Bill Mill
't' is not defined > >>> > > or > > >>> a=[ lambda t: t**n for n in range(4) ] > >>> t=2 > >>> a > [ at 0x403dcc6c>, at 0x403dcca4>, > at 0x403dccdc>, at 0x403dcd14>] > >>> t=3 > >>> a > [

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-22 Thread El Pitonero
Bengt Richter wrote: > I still don't know what you are asking for, but here is a toy, > ... > But why not spend some time with the tutorials, so have a few more cards in your deck > before you try to play for real? ;-) Communication problem. All he wanted is automatic evaluation a la spreadsheet

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-22 Thread Terry Hancock
ted? If you want an *answer*, you need to ask a *question*. Perhaps you don't know how to call such functions? E.g.: a=[ lambda t: t**n for n in range(4) ] >>> a[2](3) 27 If you want to see *names* for the functions, you have two choices: either used named functions, def un

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-22 Thread Terry Hancock
On Friday 22 April 2005 06:44 pm, Scott David Daniels wrote: > Terry Hancock wrote: > > On Friday 22 April 2005 05:18 pm, [EMAIL PROTECTED] wrote: > > > > Perhaps you don't know how to call such functions? E.g.: > > a=[ lambda t: t**n for n in range(4) ] >