色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

訪問外部類的內部類在Python問題

錢斌斌2年前12瀏覽0評論

訪問外部類的內部類在Python問題?

You're trying to access Outer's class instance, from inner class

instance. So just use factory-method to build Inner instance and pass

Outer instance to it.

1

2

3

4

5

6

7

8

9

10

11

12

class Outer(object):

def createInner(self):

return Outer.Inner(self)

class Inner(object):

def __init__(self, outer_instance):

self.outer_instance = outer_instance

self.outer_instance.somemethod()

def inner_method(self):

self.outer_instance.anothermethod()