Skip to content

Commit 9969a06

Browse files
committed
lib.memory: remove Memory.Init.depth.
This attribute is fully redundant with `.__len__()`, and is out of place on a `list`-like container like `Memory.Init`. The `.shape` attribute, however, provides a unique function.
1 parent adc640b commit 9969a06

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

amaranth/lib/memory.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ def __init__(self, elems, *, shape, depth):
8888
def shape(self):
8989
return self._shape
9090

91-
# TODO: redundant with __len__
92-
@property
93-
def depth(self):
94-
return self._depth
95-
9691
def __getitem__(self, index):
9792
return self._elems[index]
9893

tests/test_lib_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def test_constructor(self):
285285
self.assertEqual(m.shape, 8)
286286
self.assertEqual(m.depth, 4)
287287
self.assertEqual(m.init.shape, 8)
288-
self.assertEqual(m.init.depth, 4)
288+
self.assertEqual(len(m.init), 4)
289289
self.assertEqual(m.attrs, {})
290290
self.assertIsInstance(m.init, memory.Memory.Init)
291291
self.assertEqual(list(m.init), [1, 2, 3, 0])

0 commit comments

Comments
 (0)