Python, numpy, matplotlib Flashcards
At the top of the matplotlib hierarchy is the _____ which is provided by the _____ module. At this level, functions are used to add lines, images, text, etc. to the current axes in the current figure.
state-machine environment; matplotlib.pyplot
Pyplot’s state-machine environment provides an environment that closely emulates which commercial software package?
MATLAB
Matplotlib is the whole package; ____ is a module in matplotlib; and ____ is a “convenience module” that gets installed alongside matplotlib designed to mimic the MATLAB environment (but is no longer recommended).
matplotlib.pyplot; pylab
____ is a convenience module that bulk-imports matplotlib.pyplot and numpy into a single namespace. Although many examples use ____, it is no longer recommended.
pylab
You can turn a Python list comprehension into a generator expression simply by replacing ____ with ____.
…by replacing square brackets, [ ], with parentheses, ().
You can think of a Python list comprehension as a ____ wrapped in a list constructor.
generator expression
The performance improvement from the use of generators is the result of _____, which translates to lower memory usage.
lazy (on demand) generation of values
How do you (and the Python interpreter) recognize that a function definition is actually a generator?
Both functions and generators use the “def” keyword. But functions “return” values, whereas generators “yield” values.
Generator functions create _____.
generator iterators, AKA generators
In Python, ______ create generator iterators, usually called just “generators.”
Generator functions (i.e., a def that uses “yield” instead of “return”)