Python cycle dependency of small insights

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.