summaryrefslogtreecommitdiffstats
path: root/Lib/difflib.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-06-09 20:43:48 (GMT)
committerGeorg Brandl <georg@python.org>2006-06-09 20:43:48 (GMT)
commitb2afe855e5d75a570707d6bf0e32206e4b7b1c4d (patch)
treeb637a7e78de40cf155c471e702e9b465fcd0625d /Lib/difflib.py
parent3ebef999e60cc63baafcdcfa0fd05c063715a66c (diff)
downloadcpython-b2afe855e5d75a570707d6bf0e32206e4b7b1c4d.zip
cpython-b2afe855e5d75a570707d6bf0e32206e4b7b1c4d.tar.gz
cpython-b2afe855e5d75a570707d6bf0e32206e4b7b1c4d.tar.bz2
Make use of new str.startswith/endswith semantics.
Occurences in email and compiler were ignored due to backwards compat requirements.
Diffstat (limited to 'Lib/difflib.py')
-rw-r--r--Lib/difflib.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py
index 55f69ba..39bb2d9 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -1422,8 +1422,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
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 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
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