Skip to content

Loading…

Remove the advice to 'import scipy as sp' from the documentation #67

Closed
wants to merge 1 commit into from

3 participants

@rkern
NumPy member

DOC: Remove the advice to 'import scipy as sp' from the documentation. Correct a statement about how doctest namespaces are initialized in scipy.

@rkern rkern DOC: Remove the advice to 'import scipy as sp' from the documentation…
…. Correct a statement about how doctest namespaces are initialized in scipy.
420a1db
@charris
NumPy member

Pulled.

@charris charris closed this
@rgommers
NumPy member

Entered Scipy ticket 1418 for this.

@rgommers rgommers referenced this pull request in scipy/scipy
Closed

Remove pkgload() and info.py files. #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 1, 2011
  1. @rkern

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

    rkern committed
    …. Correct a statement about how doctest namespaces are initialized in scipy.
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
Something went wrong with that request. Please try again.