Methods

A method is a function defined in a class that acts on an object. Instance methods receive self, class methods (@classmethod) receive the class, and static methods (@staticmethod) receive neither. You call them with dot notation.

Example

class Compte:
    def depot(self, montant):
        self.solde += montant

Related concepts

The whole glossary