nimble.match.allValues

nimble.match.allValues(match)

Factory for functions which will determine if all values match.

The returned function is designed to input a Nimble data object and output True if every value in that object is 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)
>>> allOne = allValues(1)
>>> allOne(X)
True
>>> lst = [['A', 'B', 'C'],
...        ['A', 'B', 'C'],
...        ['A', 'B', 'C']]
>>> X = nimble.data(lst)
>>> allLetterA = allValues('A')
>>> allLetterA(X)
False