5 ms·
That does not necessarily follow. Python may be striking a balance between the needs of numerical and non-numerical computing, while NumPy arrays do not need to
by eesmith 4y ago
That does not necessarily follow. Python may be striking a balance between the needs of numerical and non-numerical computing, while NumPy arrays do not need to consider non-numerical computing.
Case in point, historically NumPy has been designed for long-running programs, like hour-long calculations or notebook processing. They've chosen to import "the world" so users don't need explicit subpackage imports, allowing:
>>> import numpy
>>> numpy.polynomial.hermite.hermfromroots([2,2,3,4])
array([ 7.075e+01, -4.625e+01, 1.175e+01, -1.375e+00, 6.250e-02])
This has a high-startup cost which makes NumPy use inappropriate for short-lived programs like shell scripts, even in cases where Python's own startup cost is otherwise appropriate.