3 comments on numarray documentation
To access UInt8, etc, from numerictypes import * Maybe mention this in 4.2.1. ------- 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 ':'? ---------- 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]) 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
"Edward C. Jones" wrote:
Why does Python documentation always use the interpreter? I doubt if it is used much.
I, for one, use it all the time to explore the syntax and function of a simple statement, just like the examples. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov
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
participants (3)
-
Chris Barker
-
Edward C. Jones
-
Perry Greenfield