-
Notifications
You must be signed in to change notification settings - Fork 24
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
Iterable[T]
not being dispatched
#131
Comments
I had the doubt that this was caused by my recent refactoring and it is not. It's a bug that has existed for a while now. I think it's because bear type does not really support parametric types... |
This is the bug, cc @leycec , who probably knows already In [1]: from beartype.door import is_bearable
In [2]: from collections.abc import Iterable
In [3]: is_bearable(['ci', 'ao'], Iterable[int])
Out[3]: True |
Gah! Deep type-checking, huh? Yeah. @beartype mostly doesn't do that yet. I'm still nailing down the seemingly last remaining PEP 563 (i.e., Deep type-checking is what @beartype is all about in 2024, though. Let's optimistically choose to believe that @beartype will deeply type-check Until then, the pudgy bear cries tears of sadness for Plum. |
@ilan-gold Although import plum
@plum.dispatch
def f(x: list[int]): print("int!")
@plum.dispatch
def f(x: list[str]): print("str!")
f(['first', 'second']) # str! Clearly this is not optimal, but it might provide a workable temporary solution. :) |
Totally. Excellent workaround, @wesselb. For even more generality, consider Indeed, this is awful. To help this happen sooner, I'm accelerating deep type-checking on the @beartype roadmap. My top priorities are now:
I also didn't realize that Plum depended on deep type-checking for disambiguation. In hindsight... it makes sense. I like to think I would have prioritized all of this sooner if I'd known. Now, I can only say: "Woopsie." 🥴 |
@ilan-gold, @leycec, aha, of course @leycec Obviously there’s no need for any form of apology! Beartype is already providing an awesome feature set that’s more than sufficient. :) These are just cherries 🍒 on top of the already delicious cake 🎂. |
Hi all! Yup, I did |
From #27 (comment).
To reproduce:
Version
2.3.2
and python3.10.13
The text was updated successfully, but these errors were encountered: