Infinite loop with Python imports; looking for Pythonic way
问题 My team is working on huge project with Django. For sake of simplicity, here's plain Python to illustrate the problem (original problem has models and apps instead of classes (I know that both are classes) and packages (I know that both are packages as well)). a.py : from b import B1 class A1(object): def __init__(self): print "object A1" class A2(object): def __init__(self): print "object A2" A1() B1() b.py : from a import A2 class B1(object): def __init__(self): print "object B1" A2() When