typeguards

Using typeguard decorator: @typechecked in Python, whilst evading circular imports?

Using typeguard decorator: @typechecked in Python, whilst evading circular imports? Question: Context To prevent circular imports in Python when using type-hints, one can use the following construct: # controllers.py from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from models import Book class BookController: def __init__(self, book: "Book") -> None: self.book = book Where …

Total answers: 2