Python Basics Classes Dunder __add__ __matmul__ __getitem__

Published: 10 June 2026
on channel: Stephen Blum
53
6

Today we are wrapping up a few Python basics with two dunder methods. First is __add__, so when you add two objects, you can return a new one with combined data, like a name made from self.name plus other.name. Then we look at the matrix multiply operator, the at symbol, which uses __matmul__.

It is weird that Python uses double underscores, but that is how the language marks special methods. The cool part is the power: you can overload operators and make your classes act like built in types. While building matrix multiplication by hand, we hit a common bug: list indices must be integers, not lists, so you often need enumerate when you want indexes.

Most of the time you would use NumPy, but writing it once helps you understand what is really happening.


On this page of the site you can watch the video online Python Basics Classes Dunder __add__ __matmul__ __getitem__ with a duration of hours minute second in good quality, which was uploaded by the user Stephen Blum 10 June 2026, share the link with friends and acquaintances, this video has already been watched 53 times on youtube and it was liked by 6 viewers. Enjoy your viewing!