3 Jul
2008
3 Jul
'08
5:57 p.m.
I am against while...as syntax for a reason given above (doesn't map to an english statement nearly as well as with...as does). Besides, you can write much clearer code by making yourself a generator somewhere else that does the nasty bits, and then using a for loop to actually consume the data, like you should: def kilogenerator(file): while True: try: yield file.read(1024) except EOFError: # or whatever return for kilo in kilogenerator(myfile): process(kilo) -- Cheers, Leif