Object Oriented Python

Any sufficiently advanced technology is indistinguishable from magic.

- Author C. Clarke

Video

Python’s popularity is in part due to its simplicity. However, unlike many other “simple” languages, Python has many advanced features that, when used pragmatically, facilitate the expression of complex concepts in a concise way. Knowing some of these features is necessary, not just to level up as a developer, but because they are used often in open-source libraries.

One such features is python’s data model (AKA class model). This is where Python’s object-oriented (oo) features can really shine for making intuitive, simple APIs. The behavior of classes is controlled by dunder (double underscore methods, or “magic” methods). In this module we will learn the basics of “light handed” object-oriented design and see how to use a few of the more common dunder methods.

Warning

Object-Oriented features are like salt; a little bit is nice but its easy to overdo. If your users need a complicated class hierarchy graph to use your code you have probably overdone it.

Objectives

In this module we will learn about:

  1. Classes, instances, inheritance
  2. Dunder methods
  3. Examples of effective object oriented design

Reading

Additional Resources