ComfyUI Node: discard

Class Name

Basic data handling: SetDiscard

Category
Basic/SET
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

discard Description

SetDiscard node safely removes an item from a set without errors if the item is absent.

discard:

The SetDiscard node is designed to efficiently manage elements within a set by removing a specified item if it exists. This node is particularly useful when you want to ensure that a specific item is not present in a set without the risk of encountering errors if the item is absent. Unlike the remove method, which raises an error when the item is not found, SetDiscard quietly performs the operation, making it a safer choice for scenarios where the presence of the item is uncertain. This functionality is beneficial in various applications, such as data cleaning or preprocessing tasks, where maintaining a clean and error-free dataset is crucial.

discard Input Parameters:

set

The set parameter represents the collection of unique elements from which you want to discard an item. This input is crucial as it defines the initial dataset that will be modified by the node. The set can contain any type of elements, and its size can vary. There are no specific minimum or maximum values for this parameter, as it can be an empty set or contain multiple elements. The set's content directly impacts the node's execution, as the presence or absence of the specified item determines the outcome.

item

The item parameter specifies the element you wish to remove from the set. This parameter can be of any data type, allowing flexibility in the types of elements you can manage within your set. The impact of this parameter is straightforward: if the item is present in the set, it will be removed; if not, the set remains unchanged. There are no restrictions on the value of this parameter, and it can be any object that is hashable and can be compared within the set.

discard Output Parameters:

SET

The output parameter is a SET, which is the modified version of the input set after attempting to discard the specified item. This output reflects the state of the set post-operation, showing the remaining elements after the discard action. The importance of this output lies in its ability to provide a clean and updated dataset, free from the specified item if it was present. This ensures that the set is ready for further processing or analysis without the risk of encountering unwanted elements.

discard Usage Tips:

  • Use SetDiscard when you need to remove an item from a set without worrying about errors if the item is not present.
  • This node is ideal for cleaning datasets where certain elements need to be excluded, ensuring a streamlined and error-free data processing workflow.

discard Common Errors and Solutions:

TypeError: unhashable type

  • Explanation: This error occurs when you attempt to use an unhashable type, such as a list or dictionary, as an item in the set.
  • Solution: Ensure that the item parameter is a hashable type, such as a string, integer, or tuple, before using it with the SetDiscard node.

AttributeError: 'NoneType' object has no attribute 'discard'

  • Explanation: This error may arise if the set parameter is not properly initialized or is set to None.
  • Solution: Verify that the set parameter is correctly initialized as a set object before passing it to the SetDiscard node.

discard Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

discard