except

A Python module used for interacting with collections of objects using LINQ syntax


except

except_(enumerable, key)

Returns an Enumerable that contains elements not found in the given enumerable argument. This is also known as a set difference. This is not an executing function.

Parameters

enumerable : an Enumerable instance to perform set difference against
key : lambda function used as a key selector for both sets

Returns

An Enumerable object that is the result of a set difference.

Examples


from py_linq import Enumerable

e1 = Enumerable([
    {'value': 1},
    {'value': 2},
    {'value': 3}
])
diff = e1.except_(Enumerable([{'value': 1}], key=lambda x: x['value'])
# [{'value': 2}, {'value': 3}]