O'Reilly logo
live online training icon Live Online training

Python Next Steps: Objects, Protocols, & Dunders

Exploring Python’s objects in a hands-on fashion

Topic: Software Development
Matt Harrison

In Python everything’s an object. Join expert Matt Harrison to learn how to create objects and explore the basics of object-oriented programming. You’ll learn about inheritance, hiding attributes, data classes, and more.

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

By the end of this live, hands-on, online course, you’ll understand:

  • How Python instances and classes work
  • What dunder methods are
  • How to write a data class

And you’ll be able to:

  • Create Python classes
  • Respond to Python protocols in your instance

This training course is for you because...

  • You’re a software engineer who is looking to better understand Python.
  • You work with code and want to write more efficient code.
  • You want to become a better Python programmer.

Prerequisites

  • Basic Python knowledge (i.e., the ability to use an editor and write simple code)

Recommended preparation:

About your instructor

  • Matt runs MetaSnake, a Python and Data Science training and consulting company. He has over 15 years of experience using Python across a breadth of domains: Data Science, BI, Storage, Testing and Automation, Open Source Stack Management, and Search.

Schedule

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

Object basics (30 minutes)

  • Presentation: Types; ids; values; reference counts; return values
  • Katacoda interactive exercise: Objects
  • Q&A

Constructors and factories (25 minutes)

  • Presentation: Object creation; constructors values
  • Katacoda interactive exercise: Constructors
  • Q&A

Break (5 minutes)

Instance attributes and class attributes (30 minutes)

  • Presentation: Where attributes live on objects; how lookup occurs
  • Katacoda interactive exercise: Attributes
  • Q&A

Hiding data (25 minutes)

  • Presentation: Private attributes and methods
  • Katacoda interactive exercise: Hiding data
  • Q&A

Break (5 minutes)

Subclasses and super (30 minutes)

  • Presentation: Inheritance; leveraging base classes
  • Katacoda interactive exercise: Inheritance
  • Q&A

Data classes (25 minutes)

  • Presentation: PEP 557; data classes
  • Katacoda interactive exercise: Data classes
  • Q&A

Break (5 minutes)

Dunders (25 minutes)

  • Presentation: Object protocols—adding, str, and repr constructors values
  • Katacoda interactive exercise: Dunder

Wrap-up and Q&A (5 minutes)