Duncan Booth wrote:

It does this:

@greedy
def getCommandsFromUser():
        while True:
                yield raw_input('Command?')

                
for cmd in getCommandsFromUser():
        print "that was command", cmd

        
Command?hello
Command?goodbye
that was command hello
Command?wtf
that was command goodbye
Command?


Not here..


In [7]: def getCommandsFromUser():
        while True:
                yield raw_input('Command?')
   ...:
   ...:

In [10]: for cmd in getCommandsFromUser(): print "that was command", cmd
   ....:
Command?hi
that was command hi
Command?there
that was command there
Command?wuwuwuw
that was command wuwuwuw
Command?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to