isidentifier
Is this string a legal Python name?
- BOOLEAN
The most niche of the is-* family, and the only one that checks against a programming-language rulebook. isidentifier answers one question: could this string be a variable name in Python? If your strings are heading into code, config, or anything that cares about identifiers, this is the gate.
What it does
isidentifier wraps str.isidentifier(). It returns True if the string is a valid Python identifier: it must start with a letter or underscore, and the rest can only be letters, digits, or underscores. So "my_node" → True, "my-node" → False, "1hello" → False (can't start with a digit).
One string input, one BOOLEAN output.
Why you'd reach for it
Validating names before they're used as keys or variable-like labels. If you're building a DICT with keys you'll reference by name, or generating text that's about to be evaluated or parsed as code, this check tells you a name is structurally safe before it lands anywhere important. It's the validation primitive for "is this name well-formed" when the target is a programming language.
Honestly, most workflows never touch it - it's the kind of node you search for once, when you're doing something clever with generated identifiers, and then it's there.
Installing
Part of Basic data handling by StableLlama. In ComfyUI Manager search "Basic data handling" → Install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart. Zero runtime dependencies - pure stdlib - so there's nothing extra to install and nothing to conflict.
Where people get burned
Two traps, both inherited from Python. First, the leading-digit rule: "1hello" fails even though it looks harmless. Second - and this is the sneaky one - Python keywords pass. "def" and "class" are valid identifiers, so isidentifier returns True for them even though you can't actually use them as variable names. This node checks form, not reservedness. If you're generating names for real code, you'd want to also reject keywords yourself.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |