~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Doc/library/array.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
+-----------+----------------+-------------------+-----------------------+
25
25
| ``'B'``   | unsigned char  | int               | 1                     |
26
26
+-----------+----------------+-------------------+-----------------------+
27
 
| ``'u'``   | Py_UNICODE     | Unicode character | 2                     |
 
27
| ``'u'``   | Py_UNICODE     | Unicode character | 2 (see note)          |
28
28
+-----------+----------------+-------------------+-----------------------+
29
29
| ``'h'``   | signed short   | int               | 2                     |
30
30
+-----------+----------------+-------------------+-----------------------+
43
43
| ``'d'``   | double         | float             | 8                     |
44
44
+-----------+----------------+-------------------+-----------------------+
45
45
 
 
46
.. note::
 
47
 
 
48
   The ``'u'`` typecode corresponds to Python's unicode character.  On narrow
 
49
   Unicode builds this is 2-bytes, on wide builds this is 4-bytes.
 
50
 
46
51
The actual representation of values is determined by the machine architecture
47
52
(strictly speaking, by the C implementation).  The actual size can be accessed
48
53
through the :attr:`itemsize` attribute.  The values stored  for ``'L'`` and
53
58
The module defines the following type:
54
59
 
55
60
 
56
 
.. function:: array(typecode[, initializer])
 
61
.. class:: array(typecode[, initializer])
57
62
 
58
 
   Return a new array whose items are restricted by *typecode*, and initialized
 
63
   A new array whose items are restricted by *typecode*, and initialized
59
64
   from the optional *initializer* value, which must be a list, string, or iterable
60
65
   over elements of the appropriate type.
61
66
 
70
75
 
71
76
.. data:: ArrayType
72
77
 
73
 
   Obsolete alias for :func:`array`.
 
78
   Obsolete alias for :class:`array`.
74
79
 
75
80
Array objects support the ordinary sequence operations of indexing, slicing,
76
81
concatenation, and multiplication.  When using slice assignment, the assigned
80
85
 
81
86
The following data items and methods are also supported:
82
87
 
83
 
 
84
88
.. attribute:: array.typecode
85
89
 
86
90
   The typecode character used to create the array.