Objects: a change of perspective

20-minute lesson · module-classes-01

You are previewing this course as a guest

Read anything and run any exercise you like. It all runs in your own browser, so nothing here is saved: no XP, no progress, and the AI tutor needs an account. Sign in and your work starts counting.

Sign in

Objects: a change of perspective

20-minute lesson · module-classes-01

  • Explain the difference between a procedural call and a method call.
  • Recognize that every Python value is already an object with methods.
  • Use `type(...)` and `dir(...)` to inspect an object.
  • Distinguish "a class" (the blueprint) from "an instance" (a particular one).

Source attribution

Status: adapted

How to Think Like a Computer Scientist: Interactive Edition source · Classes — Basics / Object-oriented programming / A change of perspective / Objects Revisited

Adaptation notes. Reading rewritten in our voice. Examples grounded in objects students have already used (strings, lists, dictionaries) before defining new ones — so the OOP shift feels like noticing something that was always there. Hidden tests focus on perspective shift (method-call vs. function-call equivalence), not on defining classes yet — class definition is the next lesson.

License notes. Original chapter is GNU FDL 1.3 (Brad Miller and David Ranum). No verbatim text from the original is reproduced here.