Skip to main content

get_members_defined_in_class

FunctionSource

(v_1: str, v_2: Any) in get_members_defined_in_class(cls: type[Any], exclude_private: bool = True)

Get all members (attributes) defined in a class.

Different from inspect.getmembers, this method will exclude the attributes defined in the base class.

Arguments

Requires

NameTypeRequired
Description
clstype[Any]The class to be inspected.
exclude_privateboolA flag. If specified, will not return the attributes that starts with the "_" prefix.

Yields

NameType
Description
v_1strThe name of the member.
v_2AnyThe attribute value of the member.