I'm starting a new blogging series on Python. Today is the first day. You can follow along here and on my twitter at twitter.com/stonestwebdev
Today I used the tutorial site boot.dev to get a bit farther on my Python journey. I've reached the Object-oriented programming course, which is part 2 in the backend developer journey. I'm on Chapter 1 - Classes and it's tutorial #13 - Multiple objects.
Something discussed briefly in the coursework today is the difference between methods and functions.
Functions are a native type in most languages. They can be created anywhere in the code, and all of the inputs to the function are explicit.
A method on the other hand is a function that exists only within an object, and it usually makes use of data stored within the object to return a value or perform some operation. In this way methods can be useful when working with objects, but they are also less explicit since they may use data only available hidden within the scope of the object they are defined on.
This is a significant difference, and why some developers prefer functional programming, which does not make use of objects with hidden values.
Top comments (0)