Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2aa7e6

Browse files
committed
#4557: remove 'c' typecode from array docs and add a note in whatsnew.
1 parent 9af5235 commit d2aa7e6

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

Doc/library/array.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ defined:
1818
+-----------+----------------+-------------------+-----------------------+
1919
| Type code | C Type | Python Type | Minimum size in bytes |
2020
+===========+================+===================+=======================+
21-
| ``'c'`` | char | character | 1 |
22-
+-----------+----------------+-------------------+-----------------------+
2321
| ``'b'`` | signed char | int | 1 |
2422
+-----------+----------------+-------------------+-----------------------+
2523
| ``'B'`` | unsigned char | int | 1 |
@@ -219,15 +217,14 @@ The following data items and methods are also supported:
219217

220218
When an array object is printed or converted to a string, it is represented as
221219
``array(typecode, initializer)``. The *initializer* is omitted if the array is
222-
empty, otherwise it is a string if the *typecode* is ``'c'``, otherwise it is a
220+
empty, otherwise it is a string if the *typecode* is ``'u'``, otherwise it is a
223221
list of numbers. The string is guaranteed to be able to be converted back to an
224222
array with the same type and value using :func:`eval`, so long as the
225223
:func:`array` function has been imported using ``from array import array``.
226224
Examples::
227225

228226
array('l')
229-
array('c', 'hello world')
230-
array('u', u'hello \u2641')
227+
array('u', 'hello \u2641')
231228
array('l', [1, 2, 3, 4, 5])
232229
array('d', [1.0, 2.0, 3.14])
233230

Doc/whatsnew/3.0.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,9 @@ Some other changes to standard library modules, not covered by
625625

626626
* Cleanup of the :class:`array.array` type: the :meth:`read` and
627627
:meth:`write` methods are gone; use :meth:`fromfile` and
628-
:meth:`tofile` instead.
628+
:meth:`tofile` instead. Also, the ``'c'`` typecode for array is
629+
gone -- use either ``'b'`` for bytes or ``'u'`` for Unicode
630+
characters.
629631

630632
* Cleanup of the :mod:`operator` module: removed
631633
:func:`sequenceIncludes` and :func:`isCallable`.

0 commit comments

Comments
 (0)