Skip to content

hasattr

const hasattr: (obj: unknown, name: string) => boolean = builtins.hasattr

Defined in: packages/pythonlib/src/index.ts:194

Python hasattr() function - check if an object has an attribute

Parameters

ParameterTypeDescription
objunknownThe object to check
namestringThe name of the attribute

Returns

boolean

True if the attribute exists, false otherwise