You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a lambda is given as the RHS in an operator (example uses >>, but also occurs with others), the lambda’s type is always inferred as Any. Whereas calling the operator function directly, or passing an explicit function, does not.
fromtypingimportCallable, Generic, TypeVar_T=TypeVar('_T')
_U=TypeVar('_U')
classA(Generic[_T]):
_value: _Tdef__init__(self, val: _T) ->None: ...
def__rshift__(self, f: Callable[[_T], _U]) ->_U: ...
definc(x: int) ->int: ...
A(1) >>inc# No errorA(1).__rshift__(lambdax: x1) # No errorA(1) >> (lambdax: x1)
# │ └ Expression has type "Any"# └ Expression type contains "Any" (has type Callable[[Any], Any])
When a lambda is given as the RHS in an operator (example uses
>>
, but also occurs with others), the lambda’s type is always inferred asAny
. Whereas calling the operator function directly, or passing an explicit function, does not.The text was updated successfully, but these errors were encountered: