PyDocs

Nav

Development Tools

reveal_type

typing

function · Added in 3.11 (source)
  • reveal_type(obj, /)
Ask a static type checker to reveal the inferred type of an expression.

When a static type checker encounters a call to ``reveal_type()``,
it will emit the inferred type of the argument::

    x: int = 1
    reveal_type(x)

Running a static type checker (e.g., mypy) on this example
will produce output similar to 'Revealed type is "builtins.int"'.

At runtime, the function prints the runtime type of the
argument and returns the argument unchanged.
0 Examples
No examples for typing/reveal_type.
See Also
No see-alsos for typing/reveal_type
0 Notes
No notes for reveal_type