[Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.138, 1.139

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Wed Oct 29 01:54:44 EST 2003


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv6236/Doc/lib
Modified Files:
	libstdtypes.tex 
Log Message:
Add list.sorted() classmethod.
Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.138
retrieving revision 1.139
diff -C2 -d -r1.138 -r1.139
*** libstdtypes.tex	22 Oct 2003 02:56:40 -0000	1.138
--- libstdtypes.tex	29 Oct 2003 06:54:42 -0000	1.139
***************
*** 630,634 ****
 \begin{methoddesc}[string]{istitle}{}
 Return true if the string is a titlecased string and there is at least one
! character, i.e. uppercase characters may only follow uncased
 characters and lowercase characters only cased ones. Return false
 otherwise.
--- 630,634 ----
 \begin{methoddesc}[string]{istitle}{}
 Return true if the string is a titlecased string and there is at least one
! character, for example uppercase characters may only follow uncased
 characters and lowercase characters only cased ones. Return false
 otherwise.
***************
*** 976,979 ****
--- 976,982 ----
 \optional{, \var{reverse}=False}}})}
 	{sort the items of \var{s} in place}{(7), (8), (9), (10)}
+ \lineiii{\var{s}.sorted(\var{iterable}\optional{, \var{cmp}=None\optional{, \var{key}=None
+ \optional{, \var{reverse}=False}}})}
+ 	{return a new sorted list from the items in \var{iterable}}{(8), (9), (11)} 
 \end{tableiii}
 \indexiv{operations on}{mutable}{sequence}{types}
***************
*** 1025,1030 ****
 the sorted or reversed list.
 
! \item[(8)] The \method{sort()} method takes optional arguments for
! controlling the comparisions.
 
 \var{cmp} specifies a custom comparison function of two arguments
--- 1028,1033 ----
 the sorted or reversed list.
 
! \item[(8)] The \method{sort()} and \method{sorted()} methods take optional
! arguments for controlling the comparisions.
 
 \var{cmp} specifies a custom comparison function of two arguments
***************
*** 1053,1057 ****
 
 \item[(9)] Starting with Python 2.3, the \method{sort()} method is
! guaranteed to be stable. A sort is stable if it guarantees not to
 change the relative order of elements that compare equal --- this is
 helpful for sorting in multiple passes (for example, sort by
--- 1056,1061 ----
 
 \item[(9)] Starting with Python 2.3, the \method{sort()} method is
! guaranteed to be stable. Starting with Python 2.4, the \method{sorted()}
! method is also guaranteed to be stable. A sort is stable if it does not
 change the relative order of elements that compare equal --- this is
 helpful for sorting in multiple passes (for example, sort by
***************
*** 1063,1066 ****
--- 1067,1073 ----
 \exception{ValueError} if it can detect that the list has been
 mutated during a sort.
+ 
+ \item[(11)] \method{sorted()} is a class method that returns a new list.
+ \versionadded{2.4}
 \end{description}
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /