# [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.10, 1.11

akuchling at users.sourceforge.net akuchling at users.sourceforge.net
Thu Nov 13 16:33:29 EST 2003

Update of /cvsroot/python/python/dist/src/Doc/whatsnew
In directory sc8-pr-cvs1:/tmp/cvs-serv22893

Modified Files:
whatsnew24.tex
Log Message:
Various edits

Index: whatsnew24.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** whatsnew24.tex	12 Nov 2003 16:42:10 -0000	1.10
--- whatsnew24.tex	13 Nov 2003 21:33:26 -0000	1.11
***************
*** 105,110 ****
\var{cmp} will call the method twice for each comparison.

! Note, for simple key functions and comparison functions, it is often
! possible to avoid the \keyword{lambda} expression by using an unbound
method instead.  For example, the above case-insensitive sort is best
coded as:
--- 105,110 ----
\var{cmp} will call the method twice for each comparison.

! For simple key functions and comparison functions, it is often
! possible to avoid a \keyword{lambda} expression by using an unbound
method instead.  For example, the above case-insensitive sort is best
coded as:
***************
*** 121,128 ****
\code{L.sort(key = lambda x: x.score, reverse=True)}.

! The results of sorting are now guaranteed to be stable.  This means that
! two entries with equal keys will be returned in the same order as
! they were input.
!

\item The list type gained a \method{sorted(iterable)} method that works
--- 121,129 ----
\code{L.sort(key = lambda x: x.score, reverse=True)}.

! The results of sorting are now guaranteed to be stable.  This means
! that two entries with equal keys will be returned in the same order as
! they were input.  For example, you can sort a list of people by name,
! and then sort the list by age, resulting in a list sorted by age where
! people with the same age are in name-sorted order.

\item The list type gained a \method{sorted(iterable)} method that works
***************
*** 144,147 ****
--- 145,149 ----
[' ', 'M', 'P', 'e', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y']
>>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5)
+ >>> # Lists the contents of the dict sorted by key values
>>> for k, v in list.sorted(colormap.iteritems()):
...     print k, v
***************
*** 294,298 ****
The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
! article: .

\end{document}
--- 296,300 ----
The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
! article: Raymond Hettinger.

\end{document}



More information about the Python-checkins mailing list