[Tutor] Generator function question?

Max Noel maxnoel_fr at yahoo.fr
Sat May 7 16:06:53 CEST 2005


On May 7, 2005, at 13:22, John Clark wrote:

> (Either that, or I am not following what you mean when you say:
>
>
>>      As for how to access it, use a for loop (for i in
>> neverEndingStatus()). xrange, for example, is a generator function.
>>
>
> Can you please provide an example of how my Test1() function  
> changes based
> on your suggestion?  (sorry to be dense)
>

     Try the following code:



for i in neverEndingTest():
     print i


     breaking out of the infinite loop is left to the reader as an  
exercise ;)

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting  
and sweating as you run through my corridors... How can you challenge  
a perfect, immortal machine?"



More information about the Tutor mailing list