-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
No type inference for indexed expressions #3006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure how things are here, but I know over in Crystal (a type-inferred language), it's the same way, and it's entirely intentional; in theory, in a multi-threaded program, |
If you can find a suitable spot in the docs to add this a PR would be
appreciated!
|
@kirbyfan64:I think in mypy case, this is only because inference complexity grows really fast once you move away from simple variables. It's not because of thread safety: after all, it works fine if you replace |
Yeah, mypy has an implicit rule that we don't worry about threading issues
like that (that would be an entirely different kind of static checking
algorithm).
…On Wed, Mar 15, 2017 at 9:13 AM, pkch ***@***.***> wrote:
@kirbyfan64 <https://github.com/kirbyfan64>:I think in mypy case, this is
only because inference complexity grows really fast once you move away from
simple variables. It's not because of thread safety: after all, it works
fine if you replace x[k] with a global variable, which can be changed
from a different thread.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3006 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMo-ZpgdN8rs8cP5v44pNpjroDJZOks5rmA47gaJpZM4Mdovq>
.
--
--Guido van Rossum (python.org/~guido)
|
Duplicate of #2458. |
I'm sure there's a limit to how far type inference can go, and it's reasonable that it doesn't evaluate the result of applying an index:
But maybe an example in the docs would be helpful? A suggestion could be given to either rewrite it like this:
or to just mark it as
# type: ignore
.The text was updated successfully, but these errors were encountered: