25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

17 satır
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)