hi~~~

d2002xx d2002xx at myrealbox.com
Mon Aug 19 04:11:24 CEST 2002


> try this one :
> 
> # file useless_msg.py
> def useless_msg():
>      print 'hi, I'm learning Python !'
> 
> def main():
>      while(1)
>          useless_msg()
> 
> if __name__ == '__main__':
>      main()
> 
> 
> $ python useless_msg.py

Add a little complexity:

#############################
# file useless_msg2.py
def generate_useless_msg():
    while True:
        yield "hi, I'm learning Python !"

def main():
    msg_list = generate_useless_msg()
    for msg in msg_list:
        print msg

if __name__ == '__main__':
    main()
#############################

Hmmm... You need python 2.3 to run this...

Enjoy!



More information about the Python-list mailing list