method vs function python :
Difference between Python Methods vs Functions
|Method definition are always present inside the classes.||We don not need a class to define a functions.|
|Method are associated with the object of the classes they belong to.||but Function are not associated with any objects.|
|For method We cannot invoke it is just by its name||We can invoke a functions just by its name.|
|Method can operate on the data of the objects they associate with it||Function operate on the data you pass to them as a argument.|
|Method is dependent on the class they belong to.||Function is independent entities in a program.|
|A methods requires to have ‘self’ as it first arguments.||Function do not require any ‘self’ arguments.|
A Function must return a specific values but in Stored Procedure and it is optional: The procedure can returns 0 or n value. Function can have only input parameters, But procedure have both input/output parameter.
There are three different types of method in python.
1.The static method
2.The class method
3. The instance method
There is a Small difference between a Class and a Functions in python and it is just not only in the python it is there in every Oop Language. A class is basically a definition of an Objects. While a function is a small piece of code.