John Machin sjmachin at
Tue Nov 13 07:58:20 CET 2007

Bernard wrote:
> On 12 nov, 20:19, "Gordon C" <gc... at> wrote:
> > Absolute newbie here. In spite of the Python Software Foundation tutorial's
> > ( use of the array
> > declaration
> >   array(type[,initializer]), the Python interpreter does NOT accept the word
> > array! It , presumably, needs to have an import <something> included. Could
> > some show me how to declare arrays with some basic examples?
> > Gord.
> hey Gordon,
> here's a good reading for you:

Hey Bernard, read Gordon's message carefully; he's asking about
arrays, not lists.

Hey Gordon, You seem a little lost; here's the tutorial reference:
which produces:
The array module provides an array() object that is like a list that
stores only homogenous data and stores it more compactly. The
following example shows an array of numbers stored as two byte
unsigned binary numbers (typecode "H") rather than the usual 16 bytes
per entry for regular lists of python int objects:

    >>> from array import array
    >>> a = array('H', [4000, 10, 700, 22222])
    >>> sum(a)
    >>> a[1:3]
    array('H', [10, 700])

The 2nd word (array) is a link (
array.html) to the docs for the array module.


More information about the Python-list mailing list