Circular Import
Stefano Ovus
stefano.ovus at gmail.com
Tue Apr 12 11:28:10 EDT 2022
How can I avoid circular imports keeping separated modules ?
-- square.py
from circle import Cirle
class Square:
def __init__(self):
...
@classmethod
def from_circle(cls, circle: Circle) -> Square:
...
return cls(...)
-- circle.py
from square import Square
class Circle:
def __init__(self):
...
@classmethod
def from_square(cls, square: Square) -> Circle:
...
return cls(...)
More information about the Python-list
mailing list