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
Could you open a separate issue about the second thing? It looks like a completely different problem.
Issue number 1 looks like a pretty clear consequence of #7047 (cc. @JelleZijlstra). We might be able to make the types more specific by adding yet another overload to int.__pow__ or float.__rpow__. I can create a PR in the morning.
But this doesn't happen for 2 ** float, or for any other positive number instead of 2:
>>> 2 ** (-3.4)
0.09473228540689989
0 ** float behaves a bit surprisingly, and I don't think we should handle it specially in the stubs. In practice, the 0 is very unlikely to be specified in a way where the type checker can infer its type to be Literal[0].
Activity
TylerYep commentedon Apr 28, 2022
[-]pow float return value is Any?[/-][+]Incompatible return types (Any, object)[/+][-]Incompatible return types (Any, object)[/-][+]Incompatible return types (Any, object) errors in 0.950[/+]AlexWaygood commentedon Apr 28, 2022
Could you open a separate issue about the second thing? It looks like a completely different problem.
Issue number 1 looks like a pretty clear consequence of #7047 (cc. @JelleZijlstra). We might be able to make the types more specific by adding yet another overload to
int.__pow__orfloat.__rpow__. I can create a PR in the morning.[-]Incompatible return types (Any, object) errors in 0.950[/-][+]pow float return value is Any in 0.950[/+]Akuli commentedon Apr 28, 2022
int ** floatcan be a complex number, if the int is negative.But this doesn't happen for
2 ** float, or for any other positive number instead of 2:0 ** floatbehaves a bit surprisingly, and I don't think we should handle it specially in the stubs. In practice, the0is very unlikely to be specified in a way where the type checker can infer its type to beLiteral[0].