On 12/21/2009 1:19 PM, W. eWatson wrote:
When I use numpy.__doc__ in IDLE under Win XP, I get a heap of words without
reasonable line breaks.
"\nNumPy\n=====\n\nProvides\n 1. An array object of arbitrary homogeneous
items\n 2. Fast mathematical operations over arrays\n 3. Linear Algebra, Fourier
Transforms, Random Number
....
Is there a way to get this formated properly.
help(object)
If I use dir(numpy), I get yet a very long list that starts as:
['ALLOW_THREADS', 'BUFSIZE', 'CLIP', 'DataSource', 'ERR_CALL', 'ERR_DEFAULT',
'ERR_DEFAULT2', 'ERR_IGNORE', 'ERR_LOG', 'ERR_PRINT', 'ERR_RAISE', 'ERR_WARN',
'FLOATING_POINT_SUPPORT', 'FPE_DIVIDEBYZERO', 'FPE_INVALID', 'FPE_OVERFLOW',
'FPE_UNDERFLOW', 'False_', 'Inf', 'Infinity', 'MAXDIMS', 'MachAr', 'NAN',
'NINF', 'NZERO', 'NaN', 'PINF', 'PZERO', 'PackageLoader', 'RAISE',
'RankWarning', 'SHIFT_DIVIDEBYZERO', 'SHIFT_INVALID', 'SHIFT_OVERFLOW',
'SHIFT_UNDERFLOW', 'ScalarType', 'Tester', 'True_', 'UFUNC_BUFSIZE_DEFAULT'
....
I see this might be a dictionary. What can I do to make it more readable or
useful, or is that it? Is there a more abc as in Linux?
You can use pprint module:
import pprint
pprint.pprint(dir(object))
though help() is usually better
It the IDLE shell, it's not possible to retrieve lines entered earlier without
copying them. Is there an edit facility?
Press Alt+P (Previous) and Alt+N (Next). Or you can click/select on the
line you want to copy and press Enter.
Add to this. Isn't there a way to see the arguments and descriptions of
functions?
Use help(). Or if you're doing this without human intervention, use
`inspect` module.
--
http://mail.python.org/mailman/listinfo/python-list