标签:items init end style eva self empty none bsp
from typing import TypeVar, Generic T = TypeVar(‘T‘) class Stack(Generic[T]): def __init__(self) -> None: # Create an empty list with items of type T self.items: List[T] = [] def push(self, item: T) -> None: self.items.append(item) def pop(self) -> T: return self.items.pop() def empty(self) -> bool: return not self.items
标签:items init end style eva self empty none bsp
原文地址:https://www.cnblogs.com/wangbin2188/p/12972854.html