PyDocs

Nav

Development Tools

TypeAliasType.evaluate_value

typing

method of TypeAliasType · Added in 3.14
  • TypeAliasType.evaluate_value()
An evaluate function corresponding to the __value__ attribute. When called directly, this method supports only the VALUE format, which is equivalent to accessing the __value__ attribute directly, but the method object can be passed to annotationlib.call_evaluate_function() to evaluate the value in a different format:
1 Example
>>> type Alias = undefined
>>> Alias.__value__
Traceback (most recent call last):
...
NameError: name 'undefined' is not defined
>>> from annotationlib import Format, call_evaluate_function
>>> Alias.evaluate_value(Format.VALUE)
Traceback (most recent call last):
...
NameError: name 'undefined' is not defined
>>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)
ForwardRef('undefined')
from the Python docs
See Also
No see-alsos for typing/TypeAliasType.evaluate_value
0 Notes
No notes for TypeAliasType.evaluate_value