Skip to content

← programming package

SetMembership

Evaluate for each element of an array A whether it is in the given set S.

This returns a boolean array of the same size as A, where each element is True if the corresponding element is in S, and False otherwise. Note that this operation is between an array and a set, and not between two sets. The set can be specified as a set, list, tuple, or array, and all other values (incl. strings, bytes, numbers, bools and dicts) are treated as a one-element set containg the value. Note that, as with all set operations, this will not flatten a list of lists provided as the set, but will instead treat each inner list as a set element. n-dimensional arrays are not permitted as the set and have to be either flattened to a 1d array, or converted into a list of array slices, whichever is desired. The result has the same shape as the 'data' (first) input and will be an array (or list) of booleans if the input was an array (or list, respectively), and otherwise a single boolean. Since the first input is not a set, it can also be a multi-dimensional array. However, note that when passing a list of lists, the meaning is ambiguous since the inner lists can either be treated as containing set elements (array mode), or the lists themselves can be considered a set element (element mode); which mode is desired can be specified using the 'lists_of_lists' property. Version 1.0.0

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
IN

set

Set to check against.

verbose name
Set
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

result

Result.

verbose name
Result
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

lists_of_lists

How to handle the rare case of lists of lists in the left operand. If 'nested', the list is treated like a nested collection of elements (e.g., numbers) and those numbers are checked against the set. If 'nested-warn', the same happens and a warning is issued. If 'elements', the inner lists are treated as (composite) elements and it is checked whether those composits are present in the set.

verbose name
Lists Of Lists
default value
nested-warn
port type
EnumPort
value type
str (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)