[Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.13, 1.14

Nov. 26, 2003
5:52 p.m.
Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv21903/whatsnew Modified Files: whatsnew24.tex Log Message: Nits from a review of the documentation update. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** whatsnew24.tex 24 Nov 2003 07:14:54 -0000 1.13 --- whatsnew24.tex 26 Nov 2003 17:52:45 -0000 1.14 *************** *** 13,17 **** This article explains the new features in Python 2.4. No release date ! for Python 2.4 has been set; expect that this will happen in 2004. While Python 2.3 was primarily a library development release, Python --- 13,17 ---- This article explains the new features in Python 2.4. No release date ! for Python 2.4 has been set; expect that this will happen mid-2004. While Python 2.3 was primarily a library development release, Python *************** *** 43,46 **** --- 43,47 ---- >>> ''.join(a) # convert back into a string 'arbcd' + >>> b = set('alacazam') # form a second set >>> a - b # letters in a but not in b *************** *** 52,55 **** --- 53,57 ---- >>> a ^ b # letters in a or b but not both set(['r', 'd', 'b', 'm', 'z', 'l']) + >>> a.add('z') # add a new element >>> a.update('wxy') # add multiple new elements *************** *** 116,119 **** --- 118,126 ---- \begin{itemize} + + \item The string methods, \method{ljust()}, \method{rjust()}, and + \method{center()} now take a optional argument for specifying a + fill character other than a space. + \item The \method{sort()} method of lists gained three keyword arguments, \var{cmp}, \var{key}, and \var{reverse}. These arguments *************** *** 186,193 **** >>> L = [9,7,8,3,2,4,1,6,5] # original is left unchanged [9,7,8,3,2,4,1,6,5] >>> list.sorted('Monte Python') # any iterable may be an input [' ', '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 --- 193,202 ---- >>> L = [9,7,8,3,2,4,1,6,5] # original is left unchanged [9,7,8,3,2,4,1,6,5] + >>> list.sorted('Monte Python') # any iterable may be an input [' ', 'M', 'P', 'e', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y'] + + >>> # List the contents of a dict sorted by key values >>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5) >>> for k, v in list.sorted(colormap.iteritems()): ... print k, v *************** *** 203,207 **** \item The \function{zip()} built-in function and \function{itertools.izip()} ! now return an empty list instead of raising a \exception{TypeError} exception if called with no arguments. This makes the functions more suitable for use with variable length argument lists: --- 212,216 ---- \item The \function{zip()} built-in function and \function{itertools.izip()} ! now returns an empty list instead of raising a \exception{TypeError} exception if called with no arguments. This makes the functions more suitable for use with variable length argument lists: *************** *** 297,300 **** --- 306,315 ---- objN)}, constructs tuples from a variable length argument list of Python objects. + + \item A new function, \function{PyDict_Contains(d, k)}, implements + fast dictionary lookups without masking exceptions raised during + the loop-up process (compare with \function{PySequence_Contains()} + which is slower or \function{PyMapping_HasKey()} which clears all + exceptions). \end{itemize}
7761
Age (days ago)
7761
Last active (days ago)
1 comments
2 participants
participants (2)
-
Fred L. Drake, Jr.
-
rhettingerīŧ users.sourceforge.net