I have the following problem in Python:
class MyClass:
def __init__(self, number):
self.variable = number
def function(self, argument=(self.variable)):
some_code()
It gives me the following error:
NameError: name 'self' is not defined
I need the instance variable to act as the default value of the argument in the function. Am I doing it right in passing the instance variable like that or am I missing something?