When the python program is executed, does the source file be modified affect the program being executed?

Source: Internet
Author: User
It takes a long time for my python program to run, but sometimes I don't want to modify the parameters after the program is completed. Can I modify the source code while the program is running, then execute the new program? I don't know if this is feasible. It takes a long time for my python program to run, but sometimes I don't want to modify the parameters after the program is completed. Can I modify the source code while the program is running, then execute the new program? I don't know if this is feasible. Reply content: it has an impact, but it is very small.

The running program itself will not be affected because the python bytecode has been automatically compiled before running and runs in the memory. Unless you call reload () in the program to reload the program, the operation will not be affected.

However, if an error occurs in the program and an exception is thrown, the system immediately reads the current python source file and displays an error line. Therefore, the exception stack displays the line number of an error in the running program and the source code of the latest version. It seems a bit split. You should use command line parameters instead of modifying programs ...... Why are your parameters in the master py file?
Can't you write another file to put your parameters?
Regularly check this parameter file (such as ini, csv, json)
Then change the program execution policy. Write another script to replace the normal operation with a copy before running. Can I change the parameters in multiple threads? Not very familiar. No for this and future operations.
Think of it @ Kyon N a very interesting answer, http://zhihu.com/question/39837216/answer/83451305

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.