Skip to content

allow using modules as a type #11518

Closed
Closed
@DetachHead

Description

@DetachHead

Feature

from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from Sandpit import foo


def asdf() -> foo: # or Module[foo]
    from Sandpit import foo

    return foo

Pitch
this pattern is useful as a quick hack for resolving circular imports, also pycharm allows it

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions