I'm not new to Python, but I didn't realise that sys.stdin could be called
as an iterator, very cool!

However, when I use the following idiom:

   for line in sys.stdin:
       doSomethingWith(line)

and then type stuff into the program interactively, nothing actually happens
until I hit CTRL-D.  I expected that 'doSomethingWith(line)' would execute
after every line I input into the program, just like what used to happen
with:

   while True:
      line = sys.stdin.readline()
      if line == '': break
      doSomethingWith(line)

What is the difference?

Thanks for your help!

      Tom



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to