UniCoreFW

is_symbol()

Check if an object is a type that could be considered a 'symbol' in Python.

Implementation

This includes module types, function types, and unique identifiers. Args: obj: The object to check Returns: True if obj is a symbol-like type, False otherwise

Example

UniCoreFW.is_symbol(lambda: None)

Expected output: True

Source Code

def is_symbol(obj: Any) -> bool: return isinstance( obj, (types.ModuleType, types.BuiltinFunctionType, types.FunctionType, type) )