-
|
I was just trying to figure out what is generic and following the example in this article:- https://medium.com/@steveYeah/using-generics-in-python-99010e5056eb In this code:- If checked with mypy, would return:- while beartype didn't catch it. Beartype is initialized using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
...heh. You caught @beartype red-pawed there. Get it, red-pawed? Instead of red-handed? I'll stop now. So, Thankfully, @beartype can and will eventually support Thankfully, this is exactly what you want here. We actually have an open feature request tracking eventual @beartype support for this at #236: "Type-stable callable declarations (i.e., The Future: It's So Bright It Burns the Eyes@beartype's current roadmap for 2023—2024 looks something like: #. October, 2023: Officially document our new tl;dr: It's gonna be awhile. See everybody in 2024. |
Beta Was this translation helpful? Give feedback.
...heh. You caught @beartype red-pawed there. Get it, red-pawed? Instead of red-handed? I'll stop now.
So,
TypeVaris a known weakness for all runtime type-checkers – @beartype, @pydantic, andtypeguardalike.TypeVarwas never intended to be supported at runtime, because full-blownTypeVarsupport kinda requires crazy stuff like capturing the full graph of all types across your entire app stack via mypy-style static analysis — which is too computationally insane to reasonably (read: efficiently) perform at runtime. Like all of the other guys, @beartype mostly just silently reducesTypeVartype hints totyping.Any. What I'm saying is...... @beartype mostly just silently ignoresTypeVarty…