A newbie doubt on methods/functions calling
mr.puneet.goyal at gmail.com
mr.puneet.goyal at gmail.com
Fri Oct 7 00:13:25 EDT 2016
Let me rephrase my question in other way.
class myClass:
def __init__(self, var):
self.var = var
myObj = myClass(abc)
# I am calling instance with function name and arguments
myObj func1 arg1 arg2
Can i associate any function like __init__ with instance ? Means if I just use instance anywhere as above, it calls that function in the class and take everything as argument which I mentioned after instance? Something like below
class myClass:
def __call__(self, args):
# Then I parse the args here and call function internally
self.func1(arg1, arg2)
More information about the Python-list
mailing list