For example :
class A: def atr_one(self): self.atr_two() def atr_two(self): print('atr_two') # Как узнать кто его вызывает For example :
class A: def atr_one(self): self.atr_two() def atr_two(self): print('atr_two') # Как узнать кто его вызывает import inspect def f1(): f2() def f2(): print 'caller name:', inspect.stack()[1][3] f1() source: https://stackoverflow.com/questions/2654113/how-to-get-the-callers-method-name-in-the-called-method
class A: def atr_one(self): self.atr_two("def atr_one") def atr_two(self, text="def atr_two"): print(text) # Как узнать кто его вызывает a = A() a.atr_one() def atr_one a.atr_two() def atr_two Source: https://ru.stackoverflow.com/questions/936754/
All Articles