Python advertises some basic service:
C:\Python24>pyt hon
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.[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
With numarray, help gives unhelpful responses:
import numarray.numarr aycore 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.
Another example:
[color=blue][color=green][color=darkred]
>>> help(c.copy)[/color][/color][/color]
<bound method NumArray.copy of array([1, 2])>[color=blue][color=green][color=darkred]
>>> help(c.copy)[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "site.py", line 328, in __call__
return pydoc.help(*arg s, **kwds)
File "C:\Python24\li b\pydoc.py", line 1647, in __call__
self.help(reque st)
File "C:\Python24\li b\pydoc.py", line 1691, in help
else: doc(request, 'Help on %s:')
File "C:\Python24\li b\pydoc.py", line 1475, in doc
pager(title % desc + '\n\n' + text.document(o bject, name))
File "C:\Python24\li b\pydoc.py", line 297, in document
if inspect.isrouti ne(object): return self.docroutine (*args)
File "C:\Python24\li b\pydoc.py", line 1226, in docroutine
if object.im_self:
File "C:\Python24\Li b\site-packages\numarr ay\generic.py", line 537,
in __nonzero__
raise RuntimeError("A n 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).[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
c.copy.__doc_ does return the __doc__ string OK:[color=blue][color=green][color=darkred]
>>> c.copy.__doc__[/color][/color][/color]
'Returns a native byte order copy of the array.'[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
But c.rank.__doc__ does not:[color=blue][color=green][color=darkred]
>>> c.rank.__doc__[/color][/color][/color]
'int(x[, base]) -> integer\n\nConv ert a string or number to an integer,
if possible. A floating point\nargument will be truncated towards zero
(this does not include a string\nreprese ntation of a floating point
number!) When converting a string, use\nthe optional base. It is an
error to supply a base when converting a\nnon-string. If the argument is
outside the integer range a long object\nwill be returned instead.'[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Colin W.
C:\Python24>pyt hon
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.[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
With numarray, help gives unhelpful responses:
import numarray.numarr aycore 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.
Another example:
[color=blue][color=green][color=darkred]
>>> help(c.copy)[/color][/color][/color]
<bound method NumArray.copy of array([1, 2])>[color=blue][color=green][color=darkred]
>>> help(c.copy)[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "site.py", line 328, in __call__
return pydoc.help(*arg s, **kwds)
File "C:\Python24\li b\pydoc.py", line 1647, in __call__
self.help(reque st)
File "C:\Python24\li b\pydoc.py", line 1691, in help
else: doc(request, 'Help on %s:')
File "C:\Python24\li b\pydoc.py", line 1475, in doc
pager(title % desc + '\n\n' + text.document(o bject, name))
File "C:\Python24\li b\pydoc.py", line 297, in document
if inspect.isrouti ne(object): return self.docroutine (*args)
File "C:\Python24\li b\pydoc.py", line 1226, in docroutine
if object.im_self:
File "C:\Python24\Li b\site-packages\numarr ay\generic.py", line 537,
in __nonzero__
raise RuntimeError("A n 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).[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
c.copy.__doc_ does return the __doc__ string OK:[color=blue][color=green][color=darkred]
>>> c.copy.__doc__[/color][/color][/color]
'Returns a native byte order copy of the array.'[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
But c.rank.__doc__ does not:[color=blue][color=green][color=darkred]
>>> c.rank.__doc__[/color][/color][/color]
'int(x[, base]) -> integer\n\nConv ert a string or number to an integer,
if possible. A floating point\nargument will be truncated towards zero
(this does not include a string\nreprese ntation of a floating point
number!) When converting a string, use\nthe optional base. It is an
error to supply a base when converting a\nnon-string. If the argument is
outside the integer range a long object\nwill be returned instead.'[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Colin W.
Comment