Skip to content

Commit 3b3cd60

Browse files
committed
Make TaggedValue in basic_units a sequence
1 parent 9d12377 commit 3b3cd60

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/units/basic_units.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def __str__(self):
154154
def __len__(self):
155155
return len(self.value)
156156

157+
def __getitem__(self, key):
158+
return TaggedValue(self.value[key], self.unit)
159+
157160
def __iter__(self):
158161
# Return a generator expression rather than use `yield`, so that
159162
# TypeError is raised by iter(self) if appropriate when checking for

0 commit comments

Comments
 (0)