Python Schoolby trefilov
Шаг 1 из 4+130 XP

TypeVar bound и Self

Ограничения типов и возврат self.

bound

from typing import TypeVar
from numbers import Number
N = TypeVar("N", bound=Number)
def double(x: N) -> N:
    return x*2  # type: ignore