]> granicus.if.org Git - python/commitdiff
Use reversed() instead of creating a new temporary list.
authorRaymond Hettinger <python@rcn.com>
Mon, 4 Aug 2014 05:36:32 +0000 (22:36 -0700)
committerRaymond Hettinger <python@rcn.com>
Mon, 4 Aug 2014 05:36:32 +0000 (22:36 -0700)
Lib/difflib.py

index 4af88a9d7805f0ef25b4b39944427be4ac3ac74e..f161baafe4df4d8492df5dc873edd77836845552 100644 (file)
@@ -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