1/15
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
modules
single files containing Python code, like functions and classes, that serve as self-contained units of code
maintainability
modules allow changes to be made to independent parts without affecting the whole application
reusability
can write the code once and use it many times throughout the application
collaboration
modules allow different teams to work on an application without interfering with each other’s work
readability
modules make it easier to see what’s going on
dir()
returns a sorted list of all attributes available in a module
__file__
returns physical name of module
__package__
returns the packages to which the module belongs
__doc__
returns the docstring at the top of the module if any
__dict__
returns the entire scope of the module
__name__
returns the name of the module
packages
collections of related modules organized in directories that contain the __init__.py file
if _name_ == “_main_”
used to determine whether the Python file is being run directly or being imported as a module into another script
library
a collection of related packages and modules providing specific functionality
*args
used to pass a variable number of non-keyworded (positional) arguments to a function
the * unpacks the arguments into a tuple
**kwargs
used to pass a variable number of keyword arguments to a function
the ** unpacks the arguments into a dictionary