-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Recursive sequence type of Sequence[NotAString]
should not accept str
#18184
Comments
This works as expected (even if surprising) because |
but edit: your argument assumes an infinite horizon, but within the context of typing, I think that a finite horizon would be more appropriate, analogous to how there's also a limit on the recursion depth at runtime edit edit: if you'd parametrize |
>>> import numpy as np
>>> np.array("not a tensor", np.float64)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: 'not a tensor' |
@ilevkivskyi I also feel like this is a Mypy issue. I am passing AFAIK all of Mypy's relevant recursion tests (except the ones with |
@KotlinIsland any thoughts on this? |
I think its consistent with the concept/spec, but impractical... maybe. I think pyright is wrong/inconsistent here... let's change how it works in basedmypy 🚀🚀🚀 |
With at least mypy 1.13.0, the false negative can be reproduced with:
originally posted in #731 (comment)
The text was updated successfully, but these errors were encountered: