Шаг 1 из 4+140 XP
Generic[T]
Типизированные контейнеры.
TypeVar
from typing import TypeVar, Generic
T = TypeVar("T")
class Box(Generic[T]):
def __init__(self, x: T): self.x = x
b: Box[int] = Box(5)Типизированные контейнеры.
from typing import TypeVar, Generic
T = TypeVar("T")
class Box(Generic[T]):
def __init__(self, x: T): self.x = x
b: Box[int] = Box(5)