PEP 695 TypeAliasType.__value__
not supporting recursion intentional?
#1816
Unanswered
randolf-scholz
asked this question in
Q&A
Replies: 1 comment
-
I would recommend against using the I am not planning to change any of this behavior in the future (but that decision is not solely up to me). |
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
-
I was moving some code to PEP695 and just realized an issue. Consider the following example:
and the supposed PEP 695 analogue fails:
The issue is that
Scalar.__value__
is the Union of twoTypeAliasType
members. PEP 695 only states that "__value__
is the evaluated value of the type alias", which under certain interpretations could be considered to mean that the result shouldn't contain anyTypeAliasType
. The PEP also mentions__evaluate_value__
in the context of PEP649, i.e. the resolution of Forward References.What's the recommended way of getting the value of the
TypeAliasType
recursively? I guess for the moment, I could expand the unions manually. Will this be covered by__evaluate_value__
in the future?Beta Was this translation helpful? Give feedback.
All reactions