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
The return type of int.__pow__ is Any, since the precise type depends on the value of the right operand. Maybe we should have a strictness option that makes the return type float instead. This probably shouldn't be enabled by default, since it can generate false positives. We could use the same thing for pow() and perhaps some other commonly used stdlib functions -- and maybe even for JSON return values from json once we have recursive types.
The question is were the alternative (more strict) types would be stored? If also somewhere in typeshed, then we might need to have some syntax for this (or use the Annotated[...] proposal, which is kind of almost universal syntax):
I'm not sure what's the best way to implement the strict types. If only a handful of functions are affected, we could use the plugin system. If there are a large number of them, the Annoted[...] idea seems worth considering.
Mabe we should collect some preliminary list of possible candidates? @JelleZijlstra@srittau do you have any candidates in typeshed where a return type is Any to avoid false positives?
The return type of
int.__pow__
isAny
, since the precise type depends on the value of the right operand. Maybe we should have a strictness option that makes the return typefloat
instead. This probably shouldn't be enabled by default, since it can generate false positives. We could use the same thing forpow()
and perhaps some other commonly used stdlib functions -- and maybe even for JSON return values fromjson
once we have recursive types.See #6210 for context.
The text was updated successfully, but these errors were encountered: