1# test that no-arg super() works when self is closed over 2 3class A: 4 def __init__(self): 5 self.val = 4 6 def foo(self): 7 # we access a member of self to check that self is correct 8 return list(range(self.val)) 9class B(A): 10 def foo(self): 11 # self is closed over because it's referenced in the list comprehension 12 # and then super() must detect this and load from the closure cell 13 return [self.bar(i) for i in super().foo()] 14 def bar(self, x): 15 return 2 * x 16 17print(A().foo()) 18print(B().foo()) 19