.. _`Partition List Predicate`: .. _`org.sysess.sympathy.list.partitionlistpredicate`: Partition List Predicate ```````````````````````` .. image:: partition_list.svg :width: 48 Partition a list using a configured item-based predicate. Documentation ::::::::::::: This node takes a predicate function (a function that returns True or False) from the configuration and uses it to decide how to partition the output. The function is applied once for each input element in the list. If it returns True, then the element is written to the first output, otherwise it is written to the second output. Examples with port type == [table] and item type == table: Put tables with more than 10 rows in the first output port:: lambda item: item.number_of_rows() > 10 Put nonempty tables in the first output port:: lambda item: not item.is_empty() The name of the argument is not important. See https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions for a description of lambda functions. Have a look at the :ref:`Data type APIs` to see what methods and attributes are available on the data type that you are working with. Definition :::::::::: Input ports ........... **list** [] List Output ports ............ **list_true** [] List of items where predicate returned true **list_false** [] List of items where predicate returned false Configuration ............. **Partition function** (predicate) Function, called for each item in `list` to determine its output partition. Should return a boolean Related nodes ............. * :ref:`org.sysess.sympathy.list.grouplist` Examples ........ * :download:`Predicates.syx ` Implementation .............. .. automodule:: node_filter_list :noindex: .. class:: PartitionListPredicate :noindex: