相关疑难解决方法(0)

从python中的内部类访问外部类

我有这样的情况......

class Outer(object):

    def some_method(self):
        # do something

    class Inner(object):
        def __init__(self):
            self.Outer.some_method()    # <-- this is the line in question
Run Code Online (Sandbox Code Playgroud)

如何OuterInner类中访问类的方法?

编辑 - 感谢您的回复.我的结论是,我需要重新评估我是如何设计这个实现的,并提出一个更强大的方法.

python scope nested inner-classes

86
推荐指数
5
解决办法
6万
查看次数

标签 统计

inner-classes ×1

nested ×1

python ×1

scope ×1