Skip to main content

func_supports_parameter

Checks if a given callable supports a specific parameter by name.

def func_supports_parameter(
func: callable,
name: string
) - > boolean

Determines if a given callable accepts a specific parameter by name. Use this to safely pass arguments to functions with varying signatures without causing TypeError.

Parameters

NameTypeDescription
funccallableThe function, method, or callable object to inspect for parameter support.
namestringThe specific parameter name to search for within the callable's signature.

Returns

TypeDescription
booleanTrue if the parameter name exists in the function signature, False otherwise.