do f in with_file('file.txt'): print f.read()
def with_file(filename): f = open(filename) yield f f.close()
for f in with_file('file.txt'): print f.read()
t = "no file read yet" do f in with_file('file.txt'): t = f.read()
t = "no file read yet" for f in with_file('file.txt'): t = f.read()
-- Serhiy Storchaka -- http://mail.python.org/mailman/listinfo/python-list