Project

General

Profile

« Previous | Next » 

Revision 2038

bin/map: Fixed bug where row count was off by one if all rows in the input were exhausted, because the row that raises StopIteration was counting as a row

View differences:

bin/map
193 193
            
194 194
            if end != None: row_nums = xrange(rows_start, end)
195 195
            else: row_nums = itertools.count(rows_start)
196
            i = 0
196
            i = -1
197 197
            for i in row_nums:
198 198
                try: row = rows.next()
199
                except StopIteration: break # no more rows
199
                except StopIteration:
200
                    i -= 1 # last row # didn't count
201
                    break # no more rows
200 202
                if i < start: continue # not at start row yet
201 203
                
202 204
                process_row(row, i)

Also available in: Unified diff