ComfyUI Node: pop item

Class Name

Basic data handling: DictPopItem

Category
Basic/DICT
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

pop item Description

DictPopItem node removes and returns a random key-value pair from a dictionary safely.

pop item:

The DictPopItem node is designed to efficiently remove and return an arbitrary key-value pair from a dictionary. This node is particularly useful when you need to extract and utilize a random element from a dictionary without specifying a particular key. It simplifies the process of modifying dictionaries by automatically handling the removal of an item and providing the remaining dictionary along with the removed key and value. This functionality is beneficial in scenarios where you need to iteratively process or deconstruct dictionaries, as it allows for dynamic and flexible data handling without the need for manual key management. The node ensures that if the operation fails, no error is thrown, and the dictionary remains unchanged, providing a robust and error-tolerant mechanism for dictionary manipulation.

pop item Input Parameters:

input_dict

The input_dict parameter is the dictionary from which an arbitrary key-value pair will be removed. This parameter is crucial as it serves as the source of data for the operation. The dictionary can be of any size, and the node will attempt to pop an item from it. If the dictionary is empty, the operation will not proceed, and the dictionary will be returned unchanged. There are no specific minimum or maximum values for this parameter, as it can accept any dictionary structure.

pop item Output Parameters:

dict

The dict output parameter returns the modified dictionary after an item has been removed. This output is essential for continuing operations on the remaining data, allowing you to see the state of the dictionary post-operation.

key

The key output parameter provides the key of the removed item. This is useful for tracking which specific element was extracted from the dictionary, especially in cases where the key holds significant meaning or is needed for further processing.

value

The value output parameter contains the value associated with the removed key. This output is important for utilizing the data that was stored in the dictionary, enabling you to perform operations or analyses on the extracted value.

success

The success output parameter is a boolean that indicates whether the operation was successful. A value of True means an item was successfully removed, while False indicates that the operation did not occur, typically due to the dictionary being empty. This parameter helps in error handling and flow control within your data processing tasks.

pop item Usage Tips:

  • Use the DictPopItem node when you need to randomly extract and process elements from a dictionary without specifying a key, which can be particularly useful in iterative or randomized operations.
  • Ensure that the input dictionary is not empty before using this node to avoid unnecessary operations and to ensure that the success output returns True.

pop item Common Errors and Solutions:

Operation failed with empty dictionary

  • Explanation: This error occurs when the input dictionary is empty, and there are no items to pop.
  • Solution: Ensure that the dictionary contains at least one key-value pair before using the DictPopItem node. You can add a check to verify the dictionary's length before attempting to pop an item.

Unexpected exception during pop operation

  • Explanation: An unexpected error might occur if the dictionary type does not support item removal.
  • Solution: Verify that the input dictionary is of a mutable type that supports item removal, such as a standard Python dictionary. If using a custom or immutable dictionary type, consider converting it to a standard dictionary before using this node.

pop item 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.

pop item