Organizing Our Thoughts

In this chapter, you learned the following:

  • A module is a collection of functions and variables grouped together in a file. To use a module, you must first import it using import «modulename». After it has been imported, you refer to its contents using «modulename».«functionname» or «modulename».«variable».

  • Variable __name__ is created by Python and can be used to specify that some code should only run when the module is run directly and not when the module is imported.

  • Programs have to do more than just run to be useful; they have to run correctly. One way to ensure that they do is to test them, which you can do in Python using module doctest.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.133.233