[New-bugs-announce] [issue6430] array.array falsely advertises support for 'w' in documentation

Alexandre Vassalotti report at bugs.python.org
Mon Jul 6 22:40:27 CEST 2009

New submission from Alexandre Vassalotti <alexandre at peadrop.com>:

It looks like either array's 'w' support got lost in a merge, or the
documentation is just wrong.

>>> import array
>>> array.array('w', "hello")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, f or d)
>>> print(array.__doc__)
This module defines an object type which can efficiently represent
an array of basic values: characters, integers, floating point
numbers.  Arrays are sequence types and behave very much like lists,
except that the type of objects stored in them is constrained.  The
type is specified at object creation time by using a type code, which
is a single character.  The following type codes are defined:

    Type code   C Type             Minimum size in bytes 
    'b'         signed integer     1 
    'B'         unsigned integer   1 
    'u'         Unicode character  2 (see note) 
    'h'         signed integer     2 
    'H'         unsigned integer   2 
    'i'         signed integer     2 
    'I'         unsigned integer   2 
    'w'         unicode character  4 
    'l'         signed integer     4 
    'L'         unsigned integer   4 
    'f'         floating point     4 
    'd'         floating point     8 

NOTE: The 'u' typecode corresponds to Python's unicode character. On 
narrow builds this is 2-bytes on wide builds this is 4-bytes.

assignee: georg.brandl
components: Documentation, Extension Modules
messages: 90190
nosy: alexandre.vassalotti, georg.brandl
priority: low
severity: normal
status: open
title: array.array falsely advertises support for 'w' in documentation
versions: Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list