Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

17 righe
351 B

  1. from typing import List, TypeVar
  2. T = TypeVar("T")
  3. class Stack(List[T]):
  4. """A small shim over builtin list."""
  5. @property
  6. def top(self) -> T:
  7. """Get top of stack."""
  8. return self[-1]
  9. def push(self, item: T) -> None:
  10. """Push an item on to the stack (append in stack nomenclature)."""
  11. self.append(item)