phanrahan/magma

[Types] Raise better error for non-existing Tuple key

Closed this issue · 0 comments

magma/magma/tuple.py

Lines 256 to 259 in 42b8850

def __getitem__(self, key):
if key in self.keys():
key = list(self.keys()).index(key)
return self.ts[key]

We should check that if key is a string and not in self.keys() then raise a KeyError.