[IPython-dev] Apropos for Python

Ville M. Vainio vivainio at gmail.com
Wed Dec 20 12:33:13 CST 2006


On 12/20/06, Gregory Novak <novak at ucolick.org> wrote:

> This seems like something that surely someone has written, but I
> couldn't find it so away I went...

Here's a glitch:

q:\dl\apropos.py in search_doc(needle='file', name='_Environ',
obj=<class os._Environ at 0x009D2E70>)
    114 def search_value(needle, name, obj): return needle in str(obj)
    115 def search_doc(needle, name, obj):   return hasattr(obj,
'__doc__') and \
--> 116     needle in obj.__doc__
        needle = 'file'
        obj.__doc__ = None
    117
    118 def search_name_regexp(needle, name, obj):  return
re.search(needle, name)
<type 'exceptions.TypeError'>: argument of type 'NoneType' is not iterable

i.e. if there is __doc__ but it's None, it fails. Easy to fix, of course.


-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'


More information about the IPython-dev mailing list