P
Panos Laganakos
Hello,
I'd like to know how its possible to pass a data attribute as a method
parameter.
Something in the form of:
class MyClass:
def __init__(self):
self.a = 10
self.b = '20'
def my_method(self, param1=self.a, param2=self.b):
pass
Seems to produce a NameError of 'self' not being defined.
I'd like to know how its possible to pass a data attribute as a method
parameter.
Something in the form of:
class MyClass:
def __init__(self):
self.a = 10
self.b = '20'
def my_method(self, param1=self.a, param2=self.b):
pass
Seems to produce a NameError of 'self' not being defined.