rkhwaja / pylistdiff

Diff 2 lists of objects using the given key

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

Diff 2 python lists using a given key

image

Usage

listA = [3, 2, 1]
listB = [5, 4, 3]
inA, inBoth, inB = DiffUnsortedLists(listA=listA, listB=listB, keyA=lambda x: x, keyB=lambda x: x)
assert inA == [1, 2]
assert inBoth == [(3, 3)]
assert inB == [4, 5]

listA = [1, 2, 3]
listB = [3, 4, 5]
resultB = DiffListsByKey(iterA=iter(listA), iterB=iter(listB), keyA=lambda x: x, keyB=lambda x: x)
assert inA == [1, 2]
assert inBoth == [(3, 3)]
assert inB == [4, 5]

About

Diff 2 lists of objects using the given key

License:MIT License


Languages

Language:Python 100.0%