Use with statement where it improves the documentation (closes #10461)

This commit is contained in:
Éric Araujo 2011-03-11 17:42:48 +01:00
parent 17b880a5d6
commit a3dd56b6cf
5 changed files with 16 additions and 8 deletions

View file

@ -750,8 +750,8 @@ It is also contained in the Python source distribution, as
# we're passing these as arguments to the diff function
fromdate = time.ctime(os.stat(fromfile).st_mtime)
todate = time.ctime(os.stat(tofile).st_mtime)
fromlines = open(fromfile, 'U').readlines()
tolines = open(tofile, 'U').readlines()
with open(fromlines) as fromf, open(tofile) as tof:
fromlines, tolines = list(fromf), list(tof)
if options.u:
diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile,