getattr
constgetattr: <T>(obj:unknown,name:string,defaultValue?:T) =>T|undefined=builtins.getattr
Defined in: packages/pythonlib/src/index.ts:193
Python getattr() function - get an attribute from an object
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
obj | unknown | The object to get the attribute from |
name | string | The name of the attribute |
defaultValue? | T | Optional default value if attribute doesn’t exist |
Returns
T | undefined
The attribute value or default value