Part 4 · Section 02

Classes

A class in Python is not a blueprint that exists only at compile time. It’s an ordinary object, created when the class statement runs, with its own namespace that you can inspect and change while the program is running. Instances are objects too, each with a namespace of its own. Once you see how Python searches these two namespaces, and what it does when the thing it finds is a function, most of the “magic” of object-oriented Python turns into a few simple rules.

In this section you’ll learn:

Lectures

  1. 01Objects and Classes✓
  2. 02Class Attributes✓
  3. 03Callable Class Attributes✓
  4. 04Classes are Callable✓
  5. 05Data Attributes✓
  6. 06Function Attributes✓
  7. 07Initializing Class Instances✓
  8. 08Creating Attributes at Run-Time✓
  9. 09Properties✓
  10. 10Property Decorators✓
  11. 11Read-Only and Computed Properties✓
  12. 12Deleting Properties✓
  13. 13Class and Static Methods✓
  14. 14Class Body Scope✓

Practice: quiz & exercises

12 quiz questions · 4 coding exercises

Go to practice →