MemotivaFunctions and arguments

What is the difference between a function and a method?

Functions and arguments

Audio flashcard · 0:14

Nortren·

What is the difference between a function and a method?

0:14

A function is a standalone callable defined with def at the module level. A method is a function defined inside a class. When called on an instance, the instance is automatically passed as the first argument, conventionally named self. Methods bound to an instance are called bound methods.
docs.python.org