Re: Reworking diffutil.Differ



2009/3/8 Vincent Legoll <vincent legoll gmail com>:
>     def set_sequences_iter(self, *sequences):
>        assert 0 <= len(sequences) <= 3
>        self.diffs = [[], []]
>        self.num_sequences = len(sequences)
>        self.seqlength = [len(s) for s in sequences]
>
>        if self.num_sequences >1:
>             for i in range(self.num_sequences - 1):
>                 matcher = IncrementalSequenceMatcher(None,
> sequences[1], sequences[i*2])
>                 work = matcher.initialise()
>                 while work.next() == None:
>                     yield None
>                self.diffs[i] = matcher.get_difference_opcodes()
>         yield 1
>
> Looks even shorter to me

Nice - can even get rid of that first 'if' with no effect.

Kai


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]