ITADN

Allow Ellipsis

#311Closedzedzhen 创建于 2026-04-22
Z
zedzhencommented
## BUG/PROBLEM REPORT / FEATURE REQUEST Ellipsis was banned with the reason "I see no reason to allow it, sorry." in 2017. Currently, typed code is becoming more popular. Ellipsis is used: 1) for a variable-length tuple (always available). 2) instead of unknown parameters in `typing.Callable` (if it can be imported). 3) as an unknown default value ```python from typing import Protocol, TypeVar T = TypeVar('T', contravariant=True) class A(Protocol[T]): def f(self, x: T = ...): pass class B(A[int]): def f(self, x): pass class C(A[float]): def f(self, x): pass def f(val: A[T]): val.f() f(B()) f(C()) ``` At the same time, adding Ellpsis does not add threats (`...` it does not differ from `None`, for security).
关闭于 2026-04-25 2 条评论