On Tuesday, February 13, 2018 at 2:20:51 AM UTC-6, Edward K. Ream wrote:
>
>
> Also on the list for today is generalizing diff-marked-nodes so that it 
> compares arbitrarily many nodes, two at a time. Here is the code to do this 
> from diff_list_of_files:
>
> self.root = self.create_root(aList)
> while len(aList) > 1:
>     self.path1 = aList[0]
>     aList = aList[1:]
>     for path2 in aList:
>         self.path2 = path2
>         self.diff_two_files(self.path1, self.path2)
>

Heh. Documentation suggests further improvements.  The code above should be:

self.root = self.create_root(aList)
while len(aList) > 1:
    path1 = aList[0]
    aList = aList[1:]
    for path2 in aList:
        self.diff_two_files(path1, path2)

This is clearer, and avoids the question (different in 2 and 3!) of the 
scope of path2.  diff_two_files can set the ivars in one line:

self.path1, self.path2 = fn1, fn2

Edward


-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to