If I have a function called 'classic' I would normally define it like so:
def classic(x,y):
return(x + y)
I can pass things through the function by using the parameters, such as:
classic(1,2)
If I have a method, the code would be something like:
class MyClass:
# member variables
variable1 = something
variable2 = something_else
# member functions
def function1(self, parameter1):
self.variable1 = variable1
# defining a new variable
self.variable3 = something_more
Questions:
How does
variable1get passed through the method? Isvariable1actuallyparameter1or isselfdoing something tovariable1?Why is
self.variable3 = something_moreused instead ofvariable3 = something_more?