Advanced Python objects

Go beyond the basics of object-oriented Python. Understand how the object system is implemented under the hood, and how to use that knowledge for cleaner, more idiomatic, more efficient code.

About The Course

Compared with many other languages, Python’s object-oriented facilities are quite straightforward and simple. Once you understand classes, instances, attributes, and methods, you’ve basically learned everything you need, right?

 

Maybe, if you have simple needs. But if you want to build complex object-oriented systems, or just want to really understand what Python is doing when it works with objects, then you’ll need to go deeper, looking at such topics as magic methods, inheritance, descriptors, and metaclasses. Even if you don’t use these techniques in your programs, they’ll help you to see the consistency and elegance in Python’s implementation. You’ll understand error messages that come up, and traps that people fall into.

 

Python’s objects are just as capable as those in other languages, but it takes some time to understand just how those capabilities are implemented, and how to take advantage of them. In this course, you’ll uncover all of the secrets of object-oriented Python, and come out a better, more sophisticated coder.

This Course Will Show You How To...

Advanced magic methods

Operator overloading

Multiple inheritance

__new__ (vs.__init__)

Descriptors

Metaclasses

This is the deepest and more complete course you'll find on object-oriented Python, and will give you the insights you need to use objects to their greatest potential.

Preview The Course

Equality with _eq_

operator.itemgetter

Three kinds of inheritance

Course Contents

Course Length

7.9 Hours

Number of Lessons

75

Training Materials

14 PDFs

Coding Exercises

19

  • Welcome (2 mins)
  • Intro to magic methods (6 mins)
  • Equality with __eq__ (9 mins)
  • Other comparison operators (5 mins)
  • total_ordering (4 mins)
  • The “operator” module (3 mins)
  • Exercises 1 (2 mins)
  • Exercises 1 solutions (9 mins)
  • __add__ (8 mins)
  • Reversing things with _radd_ (4 mins)
  • __iadd__ (7 mins)
  • Exercises 2 solutions (10 mins)
  • __getitem__ (7 mins)
  • operator.itemgetter (4 mins)
  • __contains__ (6 mins)
  • __int__and__float__ (6 mins)
  • __bool__ (5 mins)
  • __format__ (8 mins)
  • Exercises 3 (4 mins)
  • Exercises 3 solutions (12 mins)
  • __del__ (11 mins)
  • __getattr__ (14 mins)
  • __getattr__ vs getattr (4 mins)
  • __setattr__ (7 mins)
  • __slots__ (7 mins)
  • __getattribute__ (7 mins)
  • Exercises 4 (1 min)
  • Exercises 4 solutions (8 mins)
  • Static methods (7 mins)
  • Class methods
  • Inheritance review (11 mins)
  • Using super (7 mins)
  • Three kinds of inheritance (8 mins)
  • Exercises 5 (3 mins)
  • Exercises 5 solutions (9 mins)
  • MRO (5 mins)
  • Multiple inheritance (12 mins)
  • __bases__ (4 mins)
  • Mixins (10 mins)
  • Name mangling (8 mins)
  • Exercises 6 (3 mins)
  • Exercises 6 solutions (10 mins)
  • Abstract base classes, part 1 (6 mins)
  • Abstract base classes, part 2 (11 mins)
  • Python’s object hierarchy (11 mins)
  • Intro to context managers (7 mins)
  • How context managers work (3 mins)
  • A simple context manager (10 mins)
  • TempStdout (5 mins)
  • Deterministic random numbers (5 mins)
  • Multiple context managers (3 mins)
  • contextlib (6 mins)
  • Exercises 7 (2 mins)
  • Exercises 7 solutions (9 mins)
  • Intro to properties (6 mins)
  • thermostat (6 mins)
  • Property setters (4 mins)
  • Exercises 8 (2 mins)
  • Exercise 8 solutions (9 mins)
  • Intro to descriptors (12 mins)
  • Instance-specific descriptor values (8 mins)
  • Weak refs and descriptors (8 mins)
  • Descriptors, functions, and methods (9 mins)
  • Exercises 9 (2 mins)
  • Exercises 9 solutions (9)
  • Intro to advanced topics (2 mins)
  • Defining __new__ (5 mins)
  • Using __new__ (7 mins)
  • Creating classes with type (6 mins)
  • Metaclasses (9 mins)
  • Exercises 10 (1 min)
  • Exercise solutions 10 (4 mins)
  • Conclusion (1 min)

This Course Is Perfect For...

Coders with a strong understanding of object-oriented Python, but who want to go beyond the basics and really dig into how objects work, and how to use the most advanced techniques.

GET STARTED NOW

Monthly

Annual

Save 20%

BUY THIS COURSE

One-Time Purchase (Lifetime Access)
$ 300 One-Time
  • How do classes really work?
  • Magic methods
  • Properties and descriptors

OR

GET A MEMBERSHIP

Access All My Training
$ 40 Per Month
  • All my Python courses
  • Monthly office hours + special events
  • Private forum for members

BUY THIS COURSE

One-Time Purchase (Lifetime Access)
$ 300 One-Time
  • How do clases really work?
  • Magic methods
  • Properties and descriptors

OR

GET A MEMBERSHIP

Access All My Training
$ 400 Per Year
  • All my Python courses
  • Monthly office hours + special events
  • Private forum for members

100% Money Back Guarantee

I’m a one-person company dedicated to improving our career via Python and related technologies. If you haven’t gotten value from any of my courses, then just tell me — and I’ll refund your money. 

Meet Your Instructor

Reuven is a full-time Python trainer. In a given year, he teaches courses at companies in the United States, Europe, Israel, India, and China — as well as to people around the world, via his online courses.

Reuven created one of the first 100 Web sites in the world just after graduating from MIT’s computer science department. He opened Lerner Consulting in 1995, and has been offering training services since 1996.

In 2020, Reuven published “Python Workout,” a collection of Python exercises with extensive explanations, published by Manning. He’s currently finishing edits on “Pandas Workout,” a similar collection of exercises using the “Pandas” library for data analytics.

Reuven’s free, weekly “Better developers” newsletter, about Python and software engineering, is read by more than 30,000 developers around the globe. His “Trainer weekly” newsletter is popular among people who give corporate training.

Reuven’s most recent venture is Bamboo Weekly: Every Wednesday, he presents a problem based on current events, using a public data set. And every Thursday, he shared detailed solutions to those problems using Pandas.

Reuven’s monthly column appeared in Linux Journal from 1996 until the magazine’s demise in 2019. He was also a panelist on both the Business of Freelancing and Freelancers Show podcasts.

Reuven has a bachelor’s degree in computer science and engineering from MIT, and a PhD in learning sciences from Northwestern University. He lives in Modi’in, Israel with his wife and three children.