MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / __init__

Method __init__

example_code/item_073.py:121–126  ·  view source on GitHub ↗
(self, height, width)

Source from the content-addressed store, hash-verified

119
120class Grid:
121 def __init__(self, height, width):
122 self.height = height
123 self.width = width
124 self.rows = []
125 for _ in range(self.height):
126 self.rows.append([EMPTY] * self.width)
127
128 def get(self, y, x):
129 return self.rows[y % self.height][x % self.width]

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected