Colin J. Williams wrote: > Python advertises some basic service: > > C:\Python24>python > Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> > > With numarray, help gives unhelpful responses: > > import numarray.numarraycore as _n > c= _n.array((1, 2)) > print 'rank Value:', c.rank > print 'c.rank Help:', help(c.rank) > > Results: > rank Value: 1 > c.rank Help:Help on int object: > > class int(object) > | int(x[, base]) -> integer > | > | Convert a string or number to an integer, if possible. A floating > point > | argument will be truncated towards zero (this does not include a > ................. etc etc.
c.rank is an integer, not a method. It doesn't have a docstring. It can't have a docstring. > Another example: > > >>> help(c.copy) > <bound method NumArray.copy of array([1, 2])> > >>> help(c.copy) > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > File "site.py", line 328, in __call__ > return pydoc.help(*args, **kwds) > File "C:\Python24\lib\pydoc.py", line 1647, in __call__ > self.help(request) > File "C:\Python24\lib\pydoc.py", line 1691, in help > else: doc(request, 'Help on %s:') > File "C:\Python24\lib\pydoc.py", line 1475, in doc > pager(title % desc + '\n\n' + text.document(object, name)) > File "C:\Python24\lib\pydoc.py", line 297, in document > if inspect.isroutine(object): return self.docroutine(*args) > File "C:\Python24\lib\pydoc.py", line 1226, in docroutine > if object.im_self: > File "C:\Python24\Lib\site-packages\numarray\generic.py", line 537, > in __nonzero__ > raise RuntimeError("An array doesn't make sense as a truth value. > Use any(a) or all(a).") > RuntimeError: An array doesn't make sense as a truth value. Use any(a) > or all(a). > >>> c.copy.im_self is c . pydoc is trying to use it as a truth value (I'm not sure why, you'll have to take it up with pydoc, not numarray), but numarray has made a decision not to implement __nonzero__. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list