We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bd5faf3 commit 226968eCopy full SHA for 226968e
automata/pda/stack.py
@@ -49,6 +49,10 @@ def __iter__(self) -> Iterator[str]:
49
"""Return an interator for the stack."""
50
return iter(self.stack)
51
52
+ def __getitem__(self, key):
53
+ """Return the stack element at the given index"""
54
+ return self.stack[key]
55
+
56
def __repr__(self) -> str:
57
"""Return a string representation of the stack."""
58
return "{}({})".format(self.__class__.__name__, self.stack)
0 commit comments