O'Reilly logo
live online training icon Live Online training

Object-Oriented Programming in Python

Arianne Dee

How do you write classes and methods in Python? What does init mean? What is object-oriented programming and when should I use it?

This course will help you move beyond scripting and teach you how to write object-oriented code in Python. Along the way, we will also cover other intermediate features of the Python language, like decorators (@), dunder methods ( _name _), args, *kwargs, and exceptions.

Object-oriented programming (OOP) is a paradigm commonly used in back-end languages like Java, C++, Ruby, and Python. But while Java forces OOP style coding, Python gives you the flexibility to code in a style that feels right to you. There are many benefits to an object-oriented approach, including cleaner code that’s easier to reuse and extend. Additionally, many popular Python libraries, like the Django web framework, require object-oriented programming for writing even the most basic application.

So whether you want to make the next Instagram or you just want to better understand how the library you’re using works, adding object-oriented programming to your tool belt is a must for any Python developer.

What you'll learn-and how you can apply it

  • The difference between procedural, object-oriented, and functional programming
  • How to use and create classes, attributes, and methods
  • How Python handles “inheritance”, “encapsulation”, and “polymorphism”

This training course is for you because...

  • You’re a novice Python developer who is ready for intermediate concepts
  • You’re a Python developer who’s been scripting and wants to learn about OOP
  • You’re an intermediate/experienced developer who is new to Python
  • You’ve attended Introduction to Python Programming (live online training course) by Arianne Dee

Prerequisites

  • Some experience coding in Python 2 or 3
  • Basic understanding of the following concepts in Python: types, functions, conditionals, lists, while loops, and for loops

Course Set-up

Recommended Preparation

Recommended Follow-up

About your instructor

  • Arianne is a freelance software developer and educator from the University of British Columbia and an instructor for Canada Learning Code and MakerLabs in Vancouver, BC.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Segment 1: Introduction to Object-Oriented Programming and Python Review (45 min)

  • Install Python and PyCharm
  • Review Python Basics
  • What is Object-Oriented Programming
  • Q&A / Break (15 min)

Segment 2: Use and Create Classes in Python (45 min)

  • Look at how to use and create classes, properties, and methods
  • Learn about initializers, destructors and Python’s dunder methods
  • Learn about class methods and decorators in Python
  • Q&A / Break (15 min)

Segment 3: Intermediate Topics (50 min)

  • Learn how Python handles abstraction, encapsulation, inheritance, and polymorphism
  • Understand exceptions, args, and *kwargs

Course wrap-up, next steps, Q&A (10 min)