Skip to content

Undefined

This module provides a singleton class Undefined and UndefinedType that represents an undefined value in the Kirin interpreter.

The Undefined class is a singleton that can be used to represent an undefined value in the interpreter. It is used to indicate that a value has not been set or is not available. This is used to distinguish between an undefined value and a Python None value.

Undefined module-attribute

Undefined = UndefinedType()

Singleton instance of UndefinedType that represents an undefined value.

is_undefined

is_undefined(value: object) -> TypeIs[UndefinedType]

Check if the given value is an instance of UndefinedType.

Parameters:

Name Type Description Default
value object

The value to check.

required

Returns:

Name Type Description
bool TypeIs[UndefinedType]

True if the value is an instance of UndefinedType, False otherwise.

Source code in src/kirin/interp/undefined.py
33
34
35
36
37
38
39
40
41
42
def is_undefined(value: object) -> TypeIs[UndefinedType]:
    """Check if the given value is an instance of `UndefinedType`.

    Args:
        value (object): The value to check.

    Returns:
        bool: True if the value is an instance of `UndefinedType`, False otherwise.
    """
    return value is Undefined