Skip to content

Update docs for "Import cycles" to refer to TYPE_CHECKING #2178

Closed
@davidfstr

Description

@davidfstr

On the following page:

It is mentioned:

It is possible that in the future, mypy will change its dead code analysis and this trick will stop working. We will then offer an alternative, e.g. a constant defined by the typing module that is False at runtime but True while type checking.

The aforementioned constant now exists in the form of typing.TYPE_CHECKING. It might be useful to update the docs to refer to it, including in the example.

I could put a docs patch together if this is the correct approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions