
Aug. 26, 2003
1:49 p.m.
Samuele Pedroni wrote:
This PEP proposes that generators should grow such a close method with such semantics that the example could be rewritten as:
def all_lines(index_path): index = file(index_path,"r") try: for path in file(index_path,"r"):
^^^^^^^^^^^^^^^^^^^^
document = file(path.strip(),"r") try: for line in document: yield line finally: document.close() finally: index.close()
I think that should be 'index'. Neil