Intro to CS: Lecture 18 - More Python Class Methods


Topics: Object Oriented Programming: dunder methods, examples

We start with a review of classes and methods from last lecture.

Class vs. instance of a class.

All review for me, of course, but I like to observe how they teach it.

Dunder methods review.

Why OOP and bundling the data in this way?

  • Code is organized and modular
  • Code is easy to maintain
  • It’s easy to build upon objects to make more complex objects
  • Decomposition and abstraction at work with python classes
    • Bundling data and behaviors means you can use objects consistently
    • Dunder methods are abstracted by common operations, but they’re just methods behind the scenes