codekingpro/portable-devtools
115k
1from typing import List, TypeVar2 3T = TypeVar("T")4 5 6class Stack(List[T]):7 """A small shim over builtin list."""8 9 @property10 def top(self) -> T:11 """Get top of stack."""12 return self[-1]13 14 def push(self, item: T) -> None:15 """Push an item on to the stack (append in stack nomenclature)."""16 self.append(item)17 