[Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.121,1.122
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Mon, 14 Apr 2003 13:58:20 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv887/Doc/lib
Modified Files:
libstdtypes.tex
Log Message:
- list.insert(i, x) now interprets negative i as it would be
interpreted by slicing, so negative values count from the end of the
list. This was the only place where such an interpretation was not
placed on a list index.
Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.121
retrieving revision 1.122
diff -C2 -d -r1.121 -r1.122
*** libstdtypes.tex 20 Mar 2003 22:17:59 -0000 1.121
--- libstdtypes.tex 14 Apr 2003 20:58:14 -0000 1.122
***************
*** 942,947 ****
{return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(4)}
\lineiii{\var{s}.insert(\var{i}, \var{x})}
! {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]}
! if \code{\var{i} >= 0}}{(5)}
\lineiii{\var{s}.pop(\optional{\var{i}})}
{same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(6)}
--- 942,946 ----
{return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(4)}
\lineiii{\var{s}.insert(\var{i}, \var{x})}
! {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]}}{(5)}
\lineiii{\var{s}.pop(\optional{\var{i}})}
{same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(6)}
***************
*** 983,988 ****
\item[(5)] When a negative index is passed as the first parameter to
! the \method{insert()} method, the new element is prepended to the
! sequence.
\item[(6)] The \method{pop()} method is only supported by the list and
--- 982,989 ----
\item[(5)] When a negative index is passed as the first parameter to
! the \method{insert()} method, the list length is added, as for slice
! indices. If it is still negative, it is truncated to zero, as for
! slice indices. \versionchanged[Previously, all negative indices
! were truncated to zero]{2.3}
\item[(6)] The \method{pop()} method is only supported by the list and