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

Class Squares

Lib/test/test_builtin.py:56–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54A_GLOBAL_VALUE = 123
55
56class Squares:
57
58 def __init__(self, max):
59 self.max = max
60 self.sofar = []
61
62 def __len__(self): return len(self.sofar)
63
64 def __getitem__(self, i):
65 if not 0 <= i < self.max: raise IndexError
66 n = len(self.sofar)
67 while n <= i:
68 self.sofar.append(n*n)
69 n += 1
70 return self.sofar[i]
71
72class StrSquares:
73

Callers 3

test_filterMethod · 0.70
test_mapMethod · 0.70
test_sumMethod · 0.70

Calls

no outgoing calls

Tested by 3

test_filterMethod · 0.56
test_mapMethod · 0.56
test_sumMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…