← Reference

dunder-methods

Python dunder-methods reference.

__mul__ / __rmul__ / __imul__

Define multiplication behavior for custom classes in Python with __mul__, __rmul__, and __imul__ dunder methods.

def __mul__(self, other)