Title: Document the use of jarray and array better with respect to zeros function
Type: Severity: normal
Components: Documentation Versions:
Status: open Resolution:
Dependencies: Superseder:
Assigned To: juneau001 Nosy List: alex, amak, fwierzbicki, gmseed, juneau001
Priority: normal Keywords:

Created on 2011-06-10.13:29:03 by gmseed, last changed 2014-05-10.14:48:02 by juneau001.

msg6548 (view) Author: Graham Seed (gmseed) Date: 2011-06-10.13:29:03
The Jython documentation on your website states:

"The array module exports two factory functions:

array(type, sequence)
zeros(type, length)"

If I type:
arr = zeros('i',10)
I get the error:
'zeros' is not defined

Chapter 2 of the Jython book linked-to on your website at:

states in Listing 2-30:

arr2 = zeros(6, 'i')

noting that the ordering of the type and length are reversed. Using this ordering doesn't work either.

Thus, as a new user I am left wondering which way round the type and length are and whether this function is supported at all.
msg6621 (view) Author: A. Fox (alex) Date: 2011-08-29.13:59:37
The confusion seems to stem from the fact that jarray and array are different modules. Both are working.

>>> from array import zeros
>>> zeros('i',10)
array('i', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

>>> from jarray import zeros
>>> zeros(10, 'i')
array('i', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
msg6696 (view) Author: Alan Kennedy (amak) Date: 2011-11-02.23:31:00
I don't see an issue here. It is implicit from code listing 2-28 and from the descriptive text that the zeros method is in the jarray module: "Another useful feature of the jarray is that we can create empty arrays if we wish by using the zeros() method."

I think this issue should be closed as "rejected".
msg6836 (view) Author: Alan Kennedy (amak) Date: 2012-03-19.19:10:45
Assigning to Josh: he should decide if the book needs to clearer on this matter.
msg8374 (view) Author: Juneau001 (juneau001) Date: 2014-05-10.14:48:01
Listing 2-29 and 2-30 seem to be incorrect, as zeros is being invoked with the parameters backwards.  I will need to patch this documentation to repair these two examples.
Date User Action Args
2014-05-10 14:48:02juneau001setpriority: normal
messages: + msg8374
2014-05-04 20:34:13zyasoftsettitle: array and zeros -> Document the use of jarray and array better with respect to zeros function
2013-02-26 18:00:14fwierzbickisetnosy: + fwierzbicki
2012-03-19 19:10:45amaksetassignee: juneau001
messages: + msg6836
nosy: + juneau001
2011-11-02 23:31:00amaksetnosy: + amak
messages: + msg6696
2011-08-29 13:59:37alexsetnosy: + alex
messages: + msg6621
2011-06-10 13:29:03gmseedcreate