Answer the question
In order to leave comments, you need to log in
How to run a function through self?
Help with such a problem, how to assign a value to a function in self, and then call it in another?
And how to pass values to a function when creating it without calling it?
class create:
def person(self, name, handler):
self.name = name
self.handler = handler <--- Здесь проблема
return self
def start(self):
self.handler()
print("Started")
class make:
def Simple(self,type):
self.type = type
print("send %s" % self.type)
mage = make().Simple("Ogr") <--- Как задать здесь аргумент для self без вызова функции.
man = create()
man.person("Dukalis", mage)
man.start() <--- Как при запуске этой функции сделать так, чтобы запустилась и функция Simple?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question