nimble.match.anyValues

nimble.match.anyValues(match)

Factory for functions which will determine if any values match.

The returned function is designed to input a Nimble data object and output True if one or more values in that object contain a match, otherwise False.

Parameters:

match (value, iterable, or function) –

  • value - The value to match in the data.

  • iterable - A list-like, container of values to match in the data.

  • function - Input a value and return True if that value is a match.

Returns:

bool

Examples

>>> lst = [[1, 1, 1],
...        [1, 1, 1],
...        [1, 1, -1]]
>>> X =nimble.data(lst)
>>> anyNegativeOne = anyValues(-1)
>>> anyNegativeOne(X)
True
>>> lst = [['A', 'B', 'C'],
...        ['A', 'B', 'C'],
...        ['A', 'B', 'C']]
>>> X =nimble.data(lst)
>>> anyLetterD = anyValues('D')
>>> anyLetterD(X)
False