modules

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

flashcard set

Earn XP

12 Terms

1
New cards
module
a single file, containing Python code that someone
else wrote
2
New cards
package
multiple related modules put together
3
New cards
library
another term for module
4
New cards
example of a module being imported without "everything being brought in" and without bringing in specific functions
knowt flashcard image
5
New cards
example of a module being imported without "everything being brought in" but with certain functions brought in
knowt flashcard image
6
New cards
example of EVERYTHING being imported from a module
knowt flashcard image
7
New cards
accessing a module in a package
knowt flashcard image
8
New cards
importing a module for a certain function and nicknaming that function
knowt flashcard image
9
New cards
docstring
a string that is the first line of indented code after the definition of a function. this states what the function does and gives information about parameters needed, default parameter values, return values, etc.
This string is usually in triple quotes
10
New cards
a command that will display the names and docstrings for every function inside, after the module is imported
import math
help(<module name>)
example:
help(math)
11
New cards
a command that will display the docstring of one function, after the module for the function has been imported
import math
help(<function name>)
example:
help(math.sqrt)
12
New cards
abstraction
abstraction == independence and isolation.
a function should not have to worry about if other functions are working. we can ignore the details of how other parts of the
program work, while we focus on one particular part