[Python-checkins] CVS: python/dist/src/Doc/lib libarray.tex,1.31,1.32

Martin v. L?wis loewis@users.sourceforge.net
Fri, 01 Mar 2002 02:27:03 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv25235/Doc/lib

Modified Files:
	libarray.tex 
Log Message:
Patch 520694: arraymodule.c improvements:
- make array.array a type
- add Py_UNICODE arrays
- support +=, *=


Index: libarray.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** libarray.tex	20 Oct 2001 04:24:09 -0000	1.31
--- libarray.tex	1 Mar 2002 10:27:01 -0000	1.32
***************
*** 6,10 ****
  
  
! This module defines a new object type which can efficiently represent
  an array of basic values: characters, integers, floating point
  numbers.  Arrays\index{arrays} are sequence types and behave very much
--- 6,10 ----
  
  
! This module defines an object type which can efficiently represent
  an array of basic values: characters, integers, floating point
  numbers.  Arrays\index{arrays} are sequence types and behave very much
***************
*** 18,21 ****
--- 18,22 ----
  \lineiii{'b'}{signed int}{1}
  \lineiii{'B'}{unsigned int}{1}
+ \lineiii{'u'}{Unicode character}{2}
  \lineiii{'h'}{signed int}{2}
  \lineiii{'H'}{unsigned int}{2}
***************
*** 36,56 ****
  
  
! The module defines the following function and type object:
  
  \begin{funcdesc}{array}{typecode\optional{, initializer}}
! Return a new array whose items are restricted by \var{typecode}, and
! initialized from the optional \var{initializer} value, which must be a
! list or a string.  The list or string is passed to the new array's
! \method{fromlist()} or \method{fromstring()} method (see below) to add
! initial items to the array.
  \end{funcdesc}
  
  \begin{datadesc}{ArrayType}
! Type object corresponding to the objects returned by
! \function{array()}.
  \end{datadesc}
  
  
! Array objects support the following data items and methods:
  
  \begin{memberdesc}[array]{typecode}
--- 37,59 ----
  
  
! The module defines the following type:
  
  \begin{funcdesc}{array}{typecode\optional{, initializer}}
! Return a new array whose items are restricted by \var{typecode},
! and initialized from the optional \var{initializer} value, which
! must be a list or a string.  The list or string is passed to the
! new array's \method{fromlist()}, \method{fromstring()}, or
! \method{fromunicode()} method (see below) to add initial items to
! the array.
  \end{funcdesc}
  
  \begin{datadesc}{ArrayType}
! Obsolete alias for \function{array}.
  \end{datadesc}
  
  
! Array objects support the ordinary sequence operations of
! indexing, slicing, concatenation, and multiplication.  The
! following data items and methods are also supported:
  
  \begin{memberdesc}[array]{typecode}
***************
*** 122,125 ****
--- 125,135 ----
  \end{methoddesc}
  
+ \begin{methoddesc}[array]{fromunicode}{s}
+ Extends this array with data from the given unicode string.
+ The array must be a type 'u' array; otherwise a ValueError
+ is raised.  Use \samp{array.fromstring(ustr.decode(enc))} to
+ append Unicode data to an array of some other type.
+ \end{methoddesc}
+ 
  \begin{methoddesc}[array]{index}{x}
  Return the smallest \var{i} such that \var{i} is the index of
***************
*** 135,139 ****
  Removes the item with the index \var{i} from the array and returns
  it. The optional argument defaults to \code{-1}, so that by default
! the last item is removed and returned. 
  \end{methoddesc}
  
--- 145,149 ----
  Removes the item with the index \var{i} from the array and returns
  it. The optional argument defaults to \code{-1}, so that by default
! the last item is removed and returned.
  \end{methoddesc}
  
***************
*** 171,174 ****
--- 181,191 ----
  \end{methoddesc}
  
+ \begin{methoddesc}[array]{tounicode}{}
+ Convert the array to a unicode string.  The array must be
+ a type 'u' array; otherwise a ValueError is raised.  Use
+ array.tostring().decode(enc) to obtain a unicode string
+ from an array of some other type.
+ \end{methoddesc}
+ 
  \begin{methoddesc}[array]{write}{f}
  \deprecated {1.5.1}
***************
*** 189,192 ****
--- 206,210 ----
  array('l')
  array('c', 'hello world')
+ array('u', u'hello \textbackslash u2641')
  array('l', [1, 2, 3, 4, 5])
  array('d', [1.0, 2.0, 3.14])