Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

17 строки
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)