diff Lib/difflib.py @ 38704:ba6eebf7c719 legacy-trunk

Make use of new str.startswith/endswith semantics. Occurences in email and compiler were ignored due to backwards compat requirements.
author Georg Brandl <georg@python.org>
date Fri, 09 Jun 2006 20:43:48 +0000
parents 16bfe9386068
children 9b8507cfbe95
line wrap: on
line diff
--- a/Lib/difflib.py	Fri Jun 09 20:01:01 2006 +0000
+++ b/Lib/difflib.py	Fri Jun 09 20:43:48 2006 +0000
@@ -1422,8 +1422,7 @@
                 num_blanks_pending -= 1
                 yield _make_line(lines,'-',0), None, True
                 continue
-            elif s.startswith('--?+') or s.startswith('--+') or \
-                 s.startswith('- '):
+            elif s.startswith(('--?+', '--+', '- ')):
                 # in delete block and see a intraline change or unchanged line
                 # coming: yield the delete line and then blanks
                 from_line,to_line = _make_line(lines,'-',0), None
@@ -1447,7 +1446,7 @@
                 num_blanks_pending += 1
                 yield None, _make_line(lines,'+',1), True
                 continue
-            elif s.startswith('+ ') or s.startswith('+-'):
+            elif s.startswith(('+ ', '+-')):
                 # will be leaving an add block: yield blanks then add line
                 from_line, to_line = None, _make_line(lines,'+',1)
                 num_blanks_to_yield,num_blanks_pending = num_blanks_pending+1,0