This lesson is being piloted (Beta version)

Object Oriented Programming in Python

Object-oriented programming is a popular technique for structuring software, particularly in larger software projects, which may involve many people. In this lesson you will learn how to use object-oriented programming to write modular, reusable software components.

Prerequisites

This lesson assumes some level of familiarity with the Python programming language. If you have not previously used Python, and in particular if you are unfamiliar with programming in general, then we would recommend reading Short Introduction to Programming in Python.

Schedule

Setup Download files required for the lesson
00:00 1. Objects in Python What is object oriented programming?
When should I use object oriented programming?
What are objects in Python?
What is a class or type?
What is an instance of a class?
What is a member?
What is a method?
Can objects belong to more than one class?
How can objects be created from a class?
00:50 2. Writing classes How are classes written in Python?
What do methods look like?
What is a constructor?
How can a class customise how its instances are constructed?
01:40 3. More on inheritance How can class relationships, where one represents a specific subset of another, be represented?
How can functionality on one class be overridden or extended by its children?
02:20 4. Decorators, class methods, and properties What is a decorator?
How do I tag methods as being applicable to a class rather than an instance?
How can I add logic to process changes to instance variables?
03:05 5. Special methods How can classes allow their instances to work with standard Python operators?
How can classes allow their instances to behave like iterables or collections?
How can classes allow their instances to be called like functions?
How can I avoid writing repetitive __init__, __repr__, and __eq__ methods for simple data-holding classes?
03:45 6. Duck typing and interfaces How does Python decide what you can and can’t do with an object?
When is inheritance not appropriate?
What alternatives are there to inheritance?
How can I formalise an interface without forcing classes to inherit from anything?
04:10 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.