a.py
from Import b Print ' ---------This is module a.py---------- ' def A (): Print " Hello, a " B () A ()
b.py
Print ' ----------This is module b.py---------- ' def b (): Print " Hello, b " def C (): Print " Hello, c " C () from Import A
Run a.py, results:
Analysis:
First to go to b.py to find B (), and b.py in the creation of the function directly after the B to it, and finally b.py to a.py to a, because b.py has been wanted, promised to a.py want. That is, I want you to give me first, so I also give you what you want
Run b.py, results:
Analysis:
a.py first to b.py to a (), but B do not agree, but to a.py first to B (), a.py not willing, even if there is not to give, who let you do not first meet my requirements.
Summary, who first must give, if not give, do not agree to the request of the other side, a little unreasonable, but also no way, the person is selfish, the program is selfish, or the repeated humility, may let a person even give something but nothing.
Today, the cycle of Python relies on thinking for a long time, this is just the idea at the moment, may not be accurate or even wrong, but I am based on the results of the program for the moment only to understand, after the new insights to add. The people who have knowledge are welcome to give correct.
Python cycle dependency of small insights