Skip to content

Commit

Permalink
Update Source/DafnyRuntime/DafnyRuntimePython/_dafny/__init__.py
Browse files Browse the repository at this point in the history
Co-authored-by: Fabio Madge <[email protected]>
  • Loading branch information
lucasmcdonald3 and fabiomadge authored Jan 23, 2025
1 parent 2167e55 commit b9b8b97
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Source/DafnyRuntime/DafnyRuntimePython/_dafny/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,8 @@ def __add__(self, other):
def __getitem__(self, key):
if isinstance(key, slice):
start, stop, step = key.indices(len(self))
if isinstance(self.elems, _SeqSlice):
# Avoiding .Elements call on SeqSlice avoids creating a list, which is expensive
return Seq(_SeqSlice(self.elems, start=start, stop=stop, step=step), isStr=self.isStr)
return Seq(_SeqSlice(self.Elements, start=start, stop=stop, step=step), isStr=self.isStr)
elements = self.elems if isinstance(self.elems, _SeqSlice) else self.Elements
return Seq(_SeqSlice(elements, start=start, stop=stop, step=step), isStr=self.isStr)
return self.Elements.__getitem__(key)

def set(self, key, value):
Expand Down

0 comments on commit b9b8b97

Please sign in to comment.