在python中,如果我想创建一个对象,它在传递给特定函数时做了一些事情,我该怎么做呢?
例如:
import logging
class TestObject:
def __logging__(self):
# It would check the calling function here and return something
# if it was a log function call from a logging class log function call
return 'Some text'