Nodes/Basic data handling/create LIST from BOOLEANs
ComfyUI Node

create LIST from BOOLEANs

Create LIST from BOOLEANs — a typed list that can't quietly drift

By StableLlama·Created about a year ago·Updated 4 days ago· 48
create LIST from BOOLEANs
    • LIST
    item_0

    If you're collecting yes/no answers to collapse with all or any, you want the typed version: create LIST from BOOLEANs. It's the same dynamic-inputs mechanism as the generic create LIST, but every slot is typed as BOOLEAN and every value gets coerced to a real True or False before it lands in the list. No drift, no surprises when you feed the result into logic that assumes booleans.

    How it works

    The node grows item_0, item_1, … slots as you add them, and each one runs through bool() on the way in:

    values = [bool(value) for value in list(kwargs.values())[:-1]]
    

    So anything truthy - a non-zero number, a non-empty string, an actual True - becomes True. Anything falsy - 0, "", None, False - becomes False. That's a feature most of the time: if a condition node hands you a 1 or 0 instead of a proper boolean, this normalizes it for you. Just remember it means the string "False" (non-empty, therefore truthy) still becomes True. The trailing empty slot gets dropped, same as every create-node in the pack.

    Output is a single LIST of booleans, ready for all (AND across the batch), any (OR across the batch), or count False for a failure tally.

    Where you'd use it

    • Batch conditionals. Run a per-item check on several things, collect the booleans, then let all decide if the whole batch is clean.
    • Option flags. Build a list of "is this feature on?" booleans and route on combinations.
    • Normalizing messy truthiness from other nodes into clean True/False values before comparison.

    Installing

    Part of the "Basic data handling" pack by StableLlama. ComfyUI Manager: search "Basic data handling", install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
    

    Restart ComfyUI. Zero dependencies, no models - pure Python, and the simplest kind of custom-node install there is.

    Gotchas worth knowing

    • bool() coercion means the string "False" and the number 2 both become True. If you need literal values preserved, use the generic create LIST instead.
    • The trailing empty slot is dropped, so you can't end with an empty string here either.
    • It builds a LIST (single Python list variable), not a native data list - the same distinction that runs through the whole pack.
    CategoryBasic/LIST

    Inputs (1)

    NameTypeDefaultDescription
    item_0optBOOLEAN

    Outputs (1)

    NameTypeDescription
    LISTLIST