MCPcopy Index your code
hub / github.com/python/cpython / C

Class C

Lib/test/test_listcomps.py:152–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150
151 def test_class_scope_free_var_with_class_cell(self):
152 class C:
153 def method(self):
154 super()
155 return __class__
156 items = [(lambda: i) for i in range(5)]
157 y = [x() for x in items]
158
159 self.assertEqual(C.y, [4, 4, 4, 4, 4])
160 self.assertIs(C().method(), C)

Calls 1

xFunction · 0.50