Language and Compiler Modules

__future__

Provides metadata about compiler feature transitions. A future statement near the start of a module can enable special compilation behavior, while an ordinary import of __future__ only exposes the feature metadata. Not all listed features still change behavior. In 3.13, the annotations future changes annotations to strings.

Formal Syntax & Structure

python syntaxpython
import __future__

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from __future__ import annotationsdef convert(x: int) -> str:    return str(x)print(repr(convert.__annotations__["x"]))
Python Reference