Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d446230

Browse files
committed
Nits from a review of the documentation update.
1 parent 7245265 commit d446230

4 files changed

Lines changed: 24 additions & 12 deletions

File tree

Doc/lib/libfuncs.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ \section{Built-in Functions \label{built-in-funcs}}
10631063

10641064
\versionchanged[Formerly, \function{zip()} required at least one argument
10651065
and \code{zip()} raised a \exception{TypeError} instead of returning
1066-
\code{[]}]{2.4}
1066+
an empty list.]{2.4}
10671067
\end{funcdesc}
10681068

10691069

Doc/lib/libsets.tex

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ \subsection{Set Objects \label{set-objects}}
9191
{new set with a shallow copy of \var{s}}
9292
\end{tableiii}
9393

94-
Note, this non-operator versions of \method{union()},
94+
Note, the non-operator versions of \method{union()},
9595
\method{intersection()}, \method{difference()}, and
9696
\method{symmetric_difference()} will accept any iterable as an argument.
9797
In contrast, their operator based counterparts require their arguments to
@@ -158,10 +158,7 @@ \subsection{Set Objects \label{set-objects}}
158158
{remove all elements from set \var{s}}
159159
\end{tableiii}
160160

161-
\versionchanged[Earlier versions had an \method{update()} method; use
162-
\method{union_update()} instead]{2.3.1}
163-
164-
Note, this non-operator versions of \method{union_update()},
161+
Note, the non-operator versions of \method{union_update()},
165162
\method{intersection_update()}, \method{difference_update()}, and
166163
\method{symmetric_difference_update()} will accept any iterable as
167164
an argument.

Doc/tut/tut.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,11 +2161,11 @@ \section{Dictionaries \label{dictionaries}}
21612161
\section{Looping Techniques \label{loopidioms}}
21622162

21632163
When looping through dictionaries, the key and corresponding value can
2164-
be retrieved at the same time using the \method{items()} method.
2164+
be retrieved at the same time using the \method{iteritems()} method.
21652165

21662166
\begin{verbatim}
21672167
>>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
2168-
>>> for k, v in knights.items():
2168+
>>> for k, v in knights.iteritems():
21692169
... print k, v
21702170
...
21712171
gallahad the pure
@@ -3957,7 +3957,7 @@ \subsection{Method Objects \label{methodObjects}}
39573957
39583958
\section{Random Remarks \label{remarks}}
39593959
3960-
[These should perhaps be placed more carefully...]
3960+
% [These should perhaps be placed more carefully...]
39613961
39623962
39633963
Data attributes override method attributes with the same name; to

Doc/whatsnew/whatsnew24.tex

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
\tableofcontents
1313

1414
This article explains the new features in Python 2.4. No release date
15-
for Python 2.4 has been set; expect that this will happen in 2004.
15+
for Python 2.4 has been set; expect that this will happen mid-2004.
1616

1717
While Python 2.3 was primarily a library development release, Python
1818
2.4 may extend the core language and interpreter in
@@ -42,6 +42,7 @@ \section{PEP 218: Built-In Set Objects}
4242
set(['a', 'r', 'b', 'c', 'd'])
4343
>>> ''.join(a) # convert back into a string
4444
'arbcd'
45+
4546
>>> b = set('alacazam') # form a second set
4647
>>> a - b # letters in a but not in b
4748
set(['r', 'd', 'b'])
@@ -51,6 +52,7 @@ \section{PEP 218: Built-In Set Objects}
5152
set(['a', 'c'])
5253
>>> a ^ b # letters in a or b but not both
5354
set(['r', 'd', 'b', 'm', 'z', 'l'])
55+
5456
>>> a.add('z') # add a new element
5557
>>> a.update('wxy') # add multiple new elements
5658
>>> a
@@ -115,6 +117,11 @@ \section{Other Language Changes}
115117
language.
116118

117119
\begin{itemize}
120+
121+
\item The string methods, \method{ljust()}, \method{rjust()}, and
122+
\method{center()} now take a optional argument for specifying a
123+
fill character other than a space.
124+
118125
\item The \method{sort()} method of lists gained three keyword
119126
arguments, \var{cmp}, \var{key}, and \var{reverse}. These arguments
120127
make some common usages of \method{sort()} simpler. All are optional.
@@ -185,10 +192,12 @@ \section{Other Language Changes}
185192
[11, 12, 13, 14, 15, 16, 17, 18, 19]
186193
>>> L = [9,7,8,3,2,4,1,6,5] # original is left unchanged
187194
[9,7,8,3,2,4,1,6,5]
195+
188196
>>> list.sorted('Monte Python') # any iterable may be an input
189197
[' ', 'M', 'P', 'e', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y']
198+
199+
>>> # List the contents of a dict sorted by key values
190200
>>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5)
191-
>>> # Lists the contents of the dict sorted by key values
192201
>>> for k, v in list.sorted(colormap.iteritems()):
193202
... print k, v
194203
...
@@ -202,7 +211,7 @@ \section{Other Language Changes}
202211

203212

204213
\item The \function{zip()} built-in function and \function{itertools.izip()}
205-
now return an empty list instead of raising a \exception{TypeError}
214+
now returns an empty list instead of raising a \exception{TypeError}
206215
exception if called with no arguments. This makes the functions more
207216
suitable for use with variable length argument lists:
208217

@@ -297,6 +306,12 @@ \section{Build and C API Changes}
297306
objN)}, constructs tuples from a variable length argument list of
298307
Python objects.
299308

309+
\item A new function, \function{PyDict_Contains(d, k)}, implements
310+
fast dictionary lookups without masking exceptions raised during
311+
the loop-up process (compare with \function{PySequence_Contains()}
312+
which is slower or \function{PyMapping_HasKey()} which clears all
313+
exceptions).
314+
300315
\end{itemize}
301316

302317

0 commit comments

Comments
 (0)