python泛型
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
相关推荐
zhangxiafll 2020-11-13
anglehearts 2020-08-17
xiaoxiaoCNDS 2020-06-25
TreasureZ 2020-06-16
lantingyue 2020-05-31
iconhot 2020-05-26
luohui 2020-04-29
fraternityjava 2020-04-29
yicuncuntu0 2020-04-19
Justhavefun 2020-02-21
alicelmx 2020-02-13
iconhot 2020-01-28
yicuncuntu0 2019-12-18
wxy0 2019-12-09
丁一鸣的CSDN 2011-06-25
iosJohnson 2019-11-05
changcongying 2019-11-05