[SciPy-dev] ANN: NumPy/SciPy Documentation Marathon 2008

Stéfan van der Walt stefan at sun.ac.za
Mon May 19 07:30:00 EDT 2008


Hi Johann

2008/5/18 Johann Cohen-Tanugi <cohen at slac.stanford.edu>:
> well, there is a little bit of magic that I do not understand. If I do
> not put an 'import numpy' at the very first Example section of the
> fromnumeric.py file (id est in the doctest of the choose function), I
> get plenty of errors stating that numpy is not known, irrespective of
> whether I call
> ipython -c "import doctest,
> numpy;doctest.testfile('/home/cohen/data1/sources/python/numpy-svn/numpy/core/fromnumeric.py',module_relative=False,globs={"numpy":
> numpy})"
> or
> ipython -c "import
> doctest;doctest.testfile('/home/cohen/data1/sources/python/numpy-svn/numpy/core/fromnumeric.py',module_relative=False)"
> On the other hand, if I put 'import numpy' in the doctest of the choose
> function, it seems to become valid for the rest of the doctests,
> irrespective of whether I execute the first or second line above.

Your observation is correct.  We shall probably inject 'numpy'
artificially into the doctest namespace before running them.  Doctest
picks up both imports made in the file itself and in doctest sections.

Regards
Stéfan (Johann) van der Walt :)



More information about the SciPy-Dev mailing list