[Numpy-discussion] np.lookfor -- still supported / working ?

Pauli Virtanen pav at iki.fi
Sat Dec 11 18:53:58 EST 2010


On Sat, 11 Dec 2010 23:40:35 +0100, Sebastian Haase wrote:

> Hi all,
> 
> I recently discovered numpy's lookfor function, which is supposed to
> look through "all kinds" of doc strings and list relevant functions
> related to given keywords. However it does not seem to work for me:
>>>> N.__version__
> '1.3.0'
>>>> N.lookfor('fft', module=None, import_modules=True, regenerate=False)
[clip]

Worksforme

>>> import numpy as np
>>> np.__version__
'1.5.1'
>>> np.lookfor('fft', module=None, import_modules=True, regenerate=False)
Search results for 'fft'
------------------------
numpy.fft.hfft
    Compute the FFT of a signal whose spectrum has Hermitian symmetry.
...


[clip]
> I especially like, that it is supposed to work for any other (not just
> numpy or scipy) module.
> But that also doesn't work:
>>>> import wx
>>>> N.lookfor('background', module='wx', import_modules=True,
>>>> regenerate=False)
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
>   File "C:\cygwin\home\haase\Priithon_25_win\numpy\lib\utils.py", line
> 574, in lookfor
>     cache = _lookfor_generate_cache(module, import_modules, regenerate)
>   File "C:\cygwin\home\haase\Priithon_25_win\numpy\lib\utils.py", line
> 729, in _lookfor_generate_cache
>     doc = inspect.getdoc(item)
>   File "C:\cygwin\home\haase\Priithon_25_win\Python25\lib\inspect.py",
> line 313, in getdoc
>     doc = object.__doc__
> NameError: Unknown C global variable
[clip]

That's more of an issue in the `wx` module in that it behaves in a non-
standard way under introspection. But yes, it would be possible to catch 
that exception and ignore it.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list