Mercurial > cpython-lru_cache-weakref
diff Lib/difflib.py @ 41501:0c5019afc55b
PEP 3114: rename .next() to .__next__() and add next() builtin.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 21 Apr 2007 15:47:16 +0000 |
| parents | f340cb045bf9 |
| children | 06145fbc7ab9 |
line wrap: on
line diff
--- a/Lib/difflib.py Tue Apr 17 21:58:50 2007 +0000 +++ b/Lib/difflib.py Sat Apr 21 15:47:16 2007 +0000 @@ -1430,7 +1430,7 @@ # so we can do some very readable comparisons. while len(lines) < 4: try: - lines.append(diff_lines_iterator.next()) + lines.append(next(diff_lines_iterator)) except StopIteration: lines.append('X') s = ''.join([line[0] for line in lines]) @@ -1517,7 +1517,7 @@ while True: # Collecting lines of text until we have a from/to pair while (len(fromlines)==0 or len(tolines)==0): - from_line, to_line, found_diff =line_iterator.next() + from_line, to_line, found_diff = next(line_iterator) if from_line is not None: fromlines.append((from_line,found_diff)) if to_line is not None: @@ -1532,7 +1532,7 @@ line_pair_iterator = _line_pair_iterator() if context is None: while True: - yield line_pair_iterator.next() + yield next(line_pair_iterator) # Handle case where user wants context differencing. We must do some # storage of lines until we know for sure that they are to be yielded. else: @@ -1545,7 +1545,7 @@ index, contextLines = 0, [None]*(context) found_diff = False while(found_diff is False): - from_line, to_line, found_diff = line_pair_iterator.next() + from_line, to_line, found_diff = next(line_pair_iterator) i = index % context contextLines[i] = (from_line, to_line, found_diff) index += 1 @@ -1565,7 +1565,7 @@ # Now yield the context lines after the change lines_to_write = context-1 while(lines_to_write): - from_line, to_line, found_diff = line_pair_iterator.next() + from_line, to_line, found_diff = next(line_pair_iterator) # If another change within the context, extend the context if found_diff: lines_to_write = context-1
