Skip to content

Methods, Initialization, and Introspection

Step 25 of 41

Inspect Classes and Objects

Introduction

This is the second lesson of chapter 9 in the Object-Oriented Programming section of PCAP-31-03 (34% of the score, 12 of 40 items). It covers objective 4.4 (introspection: hasattr(), __name__, __module__, __bases__) and the part of objective 4.2 that concerns reading what an object actually contains. Introspection means a program examining its own objects while it runs: which attributes exist, what a class is called, where it was defined, from which classes it derives.