Concepts·Certified Associate Python Programmer
Python Introspection and Class Attributes
PCAP objective 4.4 is discover the class structure, and it is a list of things you can ask an object about itself: `__class__`, `__name__`, `__bases__`, `__mro__`, `__dict__`, `__doc__`, plus `isinstance`, `issubclass` and the four `*attr` functions. Most of it is mechanical. Two details are not: `type()` and `isinstance()` disagree once inheritance is involved, and `__doc__` is not inherited.
Object-Oriented Python Guide 17 of 25 Intermediate
- Python3.14.4
- OSUbuntu 26.04 LTS
- pip25.1.1
- TimeAbout 16 min
- Reviewed23 August 2026
Written against the versions above. `__mro__` and `__bases__` are unchanged in Python 3. Every class has them, because every class is a new-style class - see {{guide:multiple-inheritance-and-the-mro}}.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RUNNER01 | 192.168.0.27 | Ubuntu 26.04 LTS | Python 3.14.4 - the only machine this path needs | 2 Core | 4 GB | 50 GB |
Before you start
-
Asking an object what it is
-
__doc__ is not inherited
-
The two dictionaries
-
isinstance and issubclass
-
The four attribute functions
-
dir on your own class
-
What the exam does with this objective