Re: Refactoring a generator function

2004-12-04 Thread max
Kent Johnson <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Here is a simple function that scans through an input file and > groups the lines of the file into sections. Sections start with > 'Name:' and end with a blank line. The function yields sections > as they are found. > > def make

Re: Refactoring a generator function

2004-12-04 Thread Steven Bethard
Kent Johnson wrote: Here is a simple function that scans through an input file and groups the lines of the file into sections. Sections start with 'Name:' and end with a blank line. The function yields sections as they are found. def makeSections(f): currSection = [] for line in f:

Refactoring a generator function

2004-12-04 Thread Kent Johnson
Here is a simple function that scans through an input file and groups the lines of the file into sections. Sections start with 'Name:' and end with a blank line. The function yields sections as they are found. def makeSections(f): currSection = [] for line in f: line = line.strip