Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Jeff Peters
On 08/16/2011 01:46 PM, Peter Otten wrote: Jeff Peters wrote: Hi; I am trying to run a function inside a continuing loop, but do not seem to be able to pass any parameters (arguments ) when I do so. I have placed working and non-working code , with output below. ## This works: def loop(fn ):

Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Prasad, Ramit
>def loop(fn ): > for i in range(5): > fn( ) > >def this_function(a=" i am not a string"): > print( a ) > >loop(this_function("I am a string") ) ## note the only change is here > >## With this as output: > > >>> >I am a string >Traceback (most recent call last): > File "/home/je

Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Peter Otten
Jeff Peters wrote: > Hi; > > I am trying to run a function inside a continuing loop, but do not seem > to be able to pass any parameters (arguments ) when I do so. > I have placed working and non-working code , with output below. > > ## This works: > > def loop(fn ): > for i in range(5): >

Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Giovanni Tirloni
On Tue, Aug 16, 2011 at 1:44 PM, Jeff Peters wrote: > Hi; > > I am trying to run a function inside a continuing loop, but do not seem to > be able to pass any parameters (arguments ) when I do so. > I have placed working and non-working code , with output below. > > ## This works: > > def loop(fn

[Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Jeff Peters
Hi; I am trying to run a function inside a continuing loop, but do not seem to be able to pass any parameters (arguments ) when I do so. I have placed working and non-working code , with output below. ## This works: def loop(fn ): for i in range(5): fn( ) def this_function(a=" i