Python's reload function

Source: Internet
Author: User

The reload () function loads the previously imported modules once again. Reloading (reload) includes the analysis process and initialization process that was applied when the module was originally imported. This allows the changed Python module to be reloaded without exiting the interpreter.

A number of points to note:
1. If the module is syntactically correct, but fails during initialization, the import process does not correctly bind the module's name to the symbol table. At this point, the module must be loaded with the import () function before the module can be reloaded.
2. Reloading the module does not delete the original old version of the module in the symbol table of the registration entries.
3. If a module takes advantage of the From ... Import ... Way to import objects from another module, the reload () function does not redefine the imported objects, you can take advantage of the import ... form to avoid this problem.
4. The Reload module that provides the class does not affect any of the saved instances of the provided class---the saved instance will continue to use the original method definition, only the new instance of the class uses the new format. This principle also applies to derived classes.

Python's reload function

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.