[Numpy-discussion] 3 comments on numarray documentation

Perry Greenfield perry at stsci.edu
Fri Dec 13 08:30:05 CST 2002


Sorry it took so long to respond. We appreciate this feedback.

Edward C. Jones writes:
 
> To access UInt8, etc,
> 
>      from numerictypes import *
> 
> Maybe mention this in 4.2.1.
> 
Are you referring to text in another part of the manual or are you
suggesting that this be added to 4.2.1? If added I would reword it
somewhat since these type names are in the numarray namespace. If 
one wants to do:

import numarray

and have the types as part of you namespace it would make sense to

import numarray
from numerictypes import *

(though if we go to a package system, this may become
from numarray.numerictypes import *)

We also need to add the fact that there are now 
UInt32, UInt64 (not on windows), Int64 types.

> -------
> 
> In 4.7
> 
>       Only one "..." is expanded in an index expression, so if one has a
>       rank-5 array C, then C[...,0,...] is the same thing as
>       C[:,:,:,0,:].
> 
> So an unexpanded "..." is treated as a ':'?
> 
yes

> ----------
> 
> In 5.1.1,
> 
>       >>> a = arange(5, type=Float64)
>       >>> print a[::-1] * 1.2
>       [ 4.8  3.6  2.4  1.2  0. ]
>       >>> multiply(a[::-1], 1.2, a)
>       >>> a
>       array([ 4.8 ,  3.6 ,  2.4 ,  1.2,  0. ])
> 
> doesn't make the desired point. Try:
> 
>       >>> a = arange(5, type=Int32)
>       >>> a
>       [0 1 2 3 4]
>       >>> print a[::-1] * 1.2
>       [ 4.8  3.6  2.4  1.2  0. ]
>       >>> multiply(a[::-1], 1.2, a)
>       >>> a
>       array([4 3 2 1 0])
> 
Yes, we will make this change

> Why does Python documentation always use the interpreter? I doubt if it 
> is used much. Why not:
> 
>       a = arange(5, type=Int32)
>       print a.type(), a
>       b = a[::-1] * 1.2
>       print b.type(), b
>       numarray.multiply(a[::-1], 1.2, a)
>       print a.type(), a
> 
Actually many do use it in interpreter mode, at least here. But I think
you miss the main point which is to show the result of each command
for the purposes of instruction. Even if you never plan to use the
interpreter (which I think would be a mistake since it is a wonderful
way of verifying that things work the way you thought they did),
it serves to show examples in a very clear and concise way. 

Perry




More information about the Numpy-discussion mailing list