You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on py_type_extractor for getting TypeNode-ASTs at runtime (it's a py3.6+ compat-layer for codegens / runtime-type-validations / etc)
While working on the project, I couldn't get the module (or module name) of TypeVars, unlike classses/functions/etc.
Is there simply no way to get 'module' of TypeVars?
here's some code-examples to show what I'm hoping to extract from TypeVars:
# -------- extract_typevar.py --------frompackageA.packageB.some_fileimport (
SomeTypeVarA
)
# how to access module (or module name) of SomeTypeVarA ?SomeTypeVarA.__module__# points to some python-typing internals 😭 # what I'm hoping to get:get_module_from_typevar(SomeTypeVarA) =='packageA.packageB.some_file'
Activity
gvanrossum commentedon Sep 18, 2020
Sorry, there is no way.