class C:
    str = {}
    def __init__(self):
        self.d = D()
        self.name = "sophia tang"

    def f(self):
        self.d.f1(self.str)
        print "self.str==",self.str

class D:
    def f1(self, str):
        str['a'] = 'hello'
        self.f2(str)
        import inspect
        caller = inspect.stack()[1][0].f_locals['self']
        print caller.name


    def f2(self, str):
        str['b'] = "sophia"

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
猜你喜欢
  • 2021-06-13
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
相关资源
相似解决方案