What's the difference between function & method in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What's the difference between function & method in Python?

3rd May 2016, 7:18 PM
shinneworld84
3 Answers
+ 9
Generally functions are performed ON objects, methods are performed BY objects. Analogy example: Function: wash a dog, repair a car, clean a room. Method: a dog barks, a car moves, a goblin attacks. Obviously a function can be a method (a boy washes a dog). In real world "method" is just an OO (object-oriented) name for functions defined inside a class.
22nd Jun 2016, 5:04 AM
Mykola Zekter
Mykola Zekter - avatar
+ 8
Methods are basically functions that belong to classes.
24th May 2016, 11:44 AM
James Flanders
- 4
methods are a part of functinos to initialize (run) the method first we have to specify the function and then the method
26th Jun 2016, 12:31 PM
Siva Chaitanya
Siva Chaitanya - avatar