Browse files

DOC: Remove the advice to 'import scipy as sp' from the documentation.

Correct a statement about how doctest namespaces are initialized in scipy.
  • Loading branch information...
1 parent 99836f3 commit d44e74df3d31dfcd37eeef11bf5af14189c42433 @rkern rkern committed with charris Apr 1, 2011
Showing with 11 additions and 7 deletions.
  1. +7 −4 doc/HOWTO_DOCUMENT.rst.txt
  2. +4 −2 doc/TESTS.rst.txt
  3. +0 −1 doc/example.py
View
11 doc/HOWTO_DOCUMENT.rst.txt
@@ -29,10 +29,13 @@ The following import conventions are used throughout the NumPy source
and documentation::
import numpy as np
- import scipy as sp
import matplotlib as mpl
import matplotlib.pyplot as plt
+Do not abbreviate ``scipy``. There is no motivating use case to
+abbreviate it in the real world, so we avoid it in the documentation
+to avoid confusion.
+
It is not necessary to do ``import numpy as np`` at the beginning of
an example. However, some sub-modules, such as ``fft``, are not
imported by default, and you have to include them explicitly::
@@ -369,9 +372,9 @@ The sections of the docstring are:
examples work, not for making the examples part of the testing framework.
The examples may assume that ``import numpy as np`` is executed before
- the example code in *numpy*, and ``import scipy as sp`` in *scipy*.
- Additional examples may make use of *matplotlib* for plotting, but should
- import it explicitly, e.g., ``import matplotlib.pyplot as plt``.
+ the example code in *numpy*. Additional examples may make use of
+ *matplotlib* for plotting, but should import it explicitly, e.g.,
+ ``import matplotlib.pyplot as plt``.
Documenting classes
View
6 doc/TESTS.rst.txt
@@ -227,8 +227,10 @@ for numpy.lib::
>>> np.lib.test(doctests=True)
The doctests are run as if they are in a fresh Python instance which
-has executed ``import numpy as np`` (tests that are part of the SciPy
-package also have an implicit ``import scipy as sp``).
+has executed ``import numpy as np``. Tests that are part of a SciPy
+subpackage will have that subpackage already imported. E.g. for a test
+in ``scipy/linalg/tests/``, the namespace will be created such that
+``from scipy import linalg`` has already executed.
``tests/``
View
1 doc/example.py
@@ -24,7 +24,6 @@
# convention used by NumPy itself::
import numpy as np
-import scipy as sp
import matplotlib as mpl
import matplotlib.pyplot as plt

0 comments on commit d44e74d

Please sign in to comment.