Windows, IDLE, __doc_, other

Benjamin Kaplan benjamin.kaplan at case.edu
Sun Dec 20 21:51:10 EST 2009


On Sun, Dec 20, 2009 at 9:16 PM, W. eWatson <wolftracks at invalid.com> 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.
>

when you just do
>> numpy.__doc__
you get the repr of the string, which uses the escaped characters.
You'd get the same thing in the interactive interpreter. Try using
print if you want to see it correctly.

> 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?
>

It's a list, not a dictionary. pprint.pprint will print 1 item per line.

> It the IDLE shell, it's not possible to retrieve lines entered earlier
> without copying them. Is there an edit facility?
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list