The top one contains the editor, the second the Python shell
Line: 379 to 379
We can therefore find out if the module is imported or executed by checking the name variable:
Changed:
< <
if _name_ == "__main__"
> >
if __name__ == "__main__"
this executes the main code only if not imported into a main program
Packages
Changed:
< <
Packages simple group of modules under one name.
> >
Packages simply group modules under one name.
Changed:
< <
Each package is a directory which MUST contain a a specific file calle
> >
Each package is a directory which MUST contain a specific file called
Changed:
< <
__init__.py which indicating the directory is a package.
> >
__init__.py indicating the directory is a package.
Changed:
< <
the init.py file may be empty.
> >
the __ init__.py file may be empty.
Package can be imported the same way as module.
Line: 401 to 401
Changed:
< <
Classes
> >
Class
Almost everything in Python is an object, with its properties and methods.
Line: 411 to 411
A child class inherits the attributes and methods from its parent class.
Changed:
< <
Creating Classes
> >
Creating a Class
Changed:
< <
The syntax for creation of classes is similar to functions
> >
The syntax for creating a class is similar to functions
Line: 423 to 423
The short description of the class can be found in the instance variable __Doc.__
Changed:
< <
Classes Example
> >
Class Example
Libraries
Changed:
< <
Libraries are a collection python packages that are found in different that gives a package hierarchy.
> >
Python library is a collection of functions and methods that allows you to
Changed:
< <
The only difference is python libraries or packages have a init.py file present in its directories.
A very typical example of a python library is matplotlib for plotting.
> >
perform many actions without writing your code
A very typical example of a python library is matplotlib for plotting.