Replies: 2 comments 2 replies
-
The native typing libraries aren't geared towards supporting this kind of runtime introspection. However, libraries that perform runtime introspection of types should support this. Examples include beartype and pydantic and the type checker I wrote, pyanalyze. Here's how you could check this with pyanalyze:
|
Beta Was this translation helpful? Give feedback.
2 replies
-
No, it’s not designed for runtime typechecking. The other tools I mentioned
do, though.
…On Thu, Dec 23, 2021 at 7:20 AM Srinivas Gorur-Shandilya < ***@***.***> wrote:
thank you -- does pyanalyze have a wrapper that i can use to enforce type
annotations?
—
Reply to this email directly, view it on GitHub
<#991 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG5K2A6GYGMOVSTL3S35N3USM43TANCNFSM5KTNS7SA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My ultimate goal is to enforce some sort of type for functions that are passed to arguments to other functions.
I have a function that looks like:
I want to implement functionality so that it only accepts functions that look like:
If I
inspect
bar, I get this:How do I work with this and make sure it's the same as the function signature as defined in the
Callable
syntax?Beta Was this translation helpful? Give feedback.
All reactions