You should use the dir()
built-in function to list members of objects instead accessing of either __dict__
or __slots__
directly.
An instance __dict__
will only list attributes set directly on the instance, while dir()
will list attributes (including methods) on the class and bases of that class as well. It'll also list anything defined as a slot.
You can use the inspect
module to help you filter the output of dir()
; if you are not interested in methods for example the inspect.ismethod()
can help.