Skip to content

gh-149985: Remove future annotations and if TYPE_CHECKING in pyrepl#149992

Open
JelleZijlstra wants to merge 2 commits into
python:mainfrom
JelleZijlstra:nofuture
Open

gh-149985: Remove future annotations and if TYPE_CHECKING in pyrepl#149992
JelleZijlstra wants to merge 2 commits into
python:mainfrom
JelleZijlstra:nofuture

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra commented May 18, 2026

from __future__ import annotations is soft-deprecated now that evaluation
of annotations is always deferred. if TYPE_CHECKING can often be replaced
with lazy imports.

A risk is that creation of dataclasses will be slower without from __future__ import annotations, because the dataclass machinery will force evaluation of annotations. However, if the annotations are simple my simple benchmarks do not show an appreciable slowdown.

…repl

`from __future__ import annotations` is soft-deprecated now that evaluation
of annotations is always deferred. `if TYPE_CHECKING` can often be replaced
with lazy imports.
@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 18, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant