From: Raymond Hettinger Date: Mon, 4 Aug 2014 05:36:32 +0000 (-0700) Subject: Use reversed() instead of creating a new temporary list. X-Git-Tag: v3.5.0a1~1135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f25a38e5687df1c50cbc101c2528dbb81205e945;p=python Use reversed() instead of creating a new temporary list. --- diff --git a/Lib/difflib.py b/Lib/difflib.py index 4af88a9d78..f161baafe4 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -1410,7 +1410,7 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None, change_re.sub(record_sub_info,markers) # process each tuple inserting our special marks that won't be # noticed by an xml/html escaper. - for key,(begin,end) in sub_info[::-1]: + for key,(begin,end) in reversed(sub_info): text = text[0:begin]+'\0'+key+text[begin:end]+'\1'+text[end:] text = text[2:] # Handle case of add/delete entire line