module looping

Will Stuyvesant hwlgw at hotmail.com
Sat May 22 02:36:41 EDT 2004


How to loop without using a looping construct; or a generator
without "yield".

----- file: generatory.py --------------------------------
import receiver

maxx = 10

def send(x):
    if x >= maxx: return
    x = x + 1
    receiver.send(x)

if __name__ == '__main__':
    receiver.send(1)
----------------------------------------------------------

----- file: receiver.py  ---------------------------------
import generator

def send(what):
    print 'receiver received:', what
    generator.send(what)
----------------------------------------------------------



More information about the Python-list mailing list