阅读背景:

Python - 我可以访问给我打电话的对象吗?

来源:互联网 

If I have this:

如果我有这个:

class A:
    def callFunction(self, obj):
        obj.otherFunction()

class B:
    def callFunction(self, obj):
        obj.otherFunction()

class C:
    def otherFunction(self):
        # here I wan't to have acces to the instance of A or B who call me.

...

# in main or other object (not matter where)
a = A()
b = B()
c = C()
a.callFunction(c) # How 'c' know that is called by an instance of A...
b.callFunction(c) # ... or B
class A:
    def ca



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: