This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: error in some byte sizes of docs in array module
Type: Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: bdb112, docs@python, scoder
Priority: normal Keywords:

Created on 2015-04-11 08:03 by bdb112, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
arraydocbug.py bdb112, 2015-04-11 08:03 same code as in comment
Messages (2)
msg240466 - (view) Author: Boyd Blackwell (bdb112) Date: 2015-04-11 08:03
See 8.6. array — Efficient arrays of numeric values¶

I think these two table entries should list 4 instead of 2, at least for 64 python.
The error is currently in 2.710rc0, but also in previous versions.
also in 3.4.3, presumably some previous versions
it might also be argued that the column heading should not but minimum size but simply Element Size (bytes)


'i'	signed int	int	2
'I'	unsigned int	long	2

code:
import array

a = array.array('I')
a.fromstring('\x01\x02\x03\x04')
print(a)
#array('I', [67305985L])  # one element as expected (4 bytes, 4 bytes/elt)

a = array.array('H')
a.fromstring('\x01\x02\x03\x04')
print(a)
#array('H', [513, 1027])  # two elements as expected (4 bytes, 2 bytes/elt)
msg240467 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2015-04-11 08:31
As noted below the table, the exact size is platform specific, so the current documentation is correct in stating a "minimum size in bytes" of "2" for int.

https://en.wikipedia.org/wiki/C_data_types

IMHO, close as "not a bug" as it works as documented.
History
Date User Action Args
2022-04-11 14:58:15adminsetgithub: 68101
2015-04-11 15:13:48r.david.murraysetstatus: open -> closed
resolution: not a bug
stage: resolved
2015-04-11 08:31:36scodersetnosy: + scoder
messages: + msg240467
2015-04-11 08:03:59bdb112create