python-opengl
python-opengl copied to clipboard
Suggestion: don't use `import scipy as sp` as a convention.
Nicolas, this looks like a fantastic book. Thanks for sharing it.
I have one suggestion. In the "Conventions" section of the Preface, you include
import scipy as sp
as one of the imports. In fact, there is almost never a good reason to do this. All the "good stuff" in scipy is in the subpackages, and these must be explicitly imported (e.g. import scipy.ndimage, or common variations such as from scipy import ndimage, import scipy.ndimage as ndi, etc.).
The top level scipy namespace imports names from numpy, so you could use names such as sp.array and sp.linspace, but a better style is to just use the numpy namespace for that. I think many SciPy and NumPy developers now think that importing all of numpy into the scipy namespace was an API mistake, and using the scipy namespace that way should be discouraged. The only reason I can think of for ever importing just the top level name scipy is to access the version as scipy.__version__, and that's not a sufficient reason for including its import in the conventions for your book. So you could (and probably should) drop the line import scipy as sp from your list of conventions.
Thanks Warren. I realize that I never do it myself. I'll correct it.