1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659
|
#! /bin/sh -e
# DP: SVN updates of the release25-maint branch (until 2006-10-29).
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
fi
case "$1" in
-patch)
cd Doc
patch $pdir -f --no-backup-if-mismatch -p0 < ../$0
;;
-unpatch)
cd Doc
patch $pdir -f --no-backup-if-mismatch -R -p0 < ../$0
;;
*)
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
esac
exit 0
# svn diff http://svn.python.org/projects/python/tags/r25/Doc http://svn.python.org/projects/python/branches/release25-maint/Doc
# diff -urN --exclude=.svn Python-2.5/Doc svn/Doc
Index: ext/extending.tex
===================================================================
--- ext/extending.tex (.../tags/r25/Doc) (revision 52528)
+++ ext/extending.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -221,6 +221,8 @@
PyObject *m;
m = Py_InitModule("spam", SpamMethods);
+ if (m == NULL)
+ return;
SpamError = PyErr_NewException("spam.error", NULL, NULL);
Py_INCREF(SpamError);
@@ -365,9 +367,9 @@
created module based upon the table (an array of \ctype{PyMethodDef}
structures) that was passed as its second argument.
\cfunction{Py_InitModule()} returns a pointer to the module object
-that it creates (which is unused here). It aborts with a fatal error
-if the module could not be initialized satisfactorily, so the caller
-doesn't need to check for errors.
+that it creates (which is unused here). It may abort with a fatal error
+for certain errors, or return \NULL{} if the module could not be
+initialized satisfactorily.
When embedding Python, the \cfunction{initspam()} function is not
called automatically unless there's an entry in the
@@ -1276,6 +1278,8 @@
PyObject *c_api_object;
m = Py_InitModule("spam", SpamMethods);
+ if (m == NULL)
+ return;
/* Initialize the C API pointer array */
PySpam_API[PySpam_System_NUM] = (void *)PySpam_System;
@@ -1362,7 +1366,9 @@
{
PyObject *m;
- Py_InitModule("client", ClientMethods);
+ m = Py_InitModule("client", ClientMethods);
+ if (m == NULL)
+ return;
if (import_spam() < 0)
return;
/* additional initialization can happen here */
Index: whatsnew/whatsnew25.tex
===================================================================
--- whatsnew/whatsnew25.tex (.../tags/r25/Doc) (revision 52528)
+++ whatsnew/whatsnew25.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -540,10 +540,10 @@
StopIteration
\end{verbatim}
-Because \keyword{yield} will often be returning \constant{None}, you
+\keyword{yield} will usually return \constant{None}, you
should always check for this case. Don't just use its value in
expressions unless you're sure that the \method{send()} method
-will be the only method used resume your generator function.
+will be the only method used to resume your generator function.
In addition to \method{send()}, there are two other new methods on
generators:
Index: dist/dist.tex
===================================================================
--- dist/dist.tex (.../tags/r25/Doc) (revision 52528)
+++ dist/dist.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -3607,7 +3607,12 @@
% todo
+\section{\module{distutils.command.bdist_msi} --- Build a Microsoft Installer binary package}
+\declaremodule[distutils.command.bdistmsi]{standard}{distutils.command.bdist_msi}
+\modulesynopsis{Build a binary distribution as a Windows MSI file}
+% todo
+
\section{\module{distutils.command.bdist_rpm} --- Build a binary distribution as a Redhat RPM and SRPM}
\declaremodule[distutils.command.bdistrpm]{standard}{distutils.command.bdist_rpm}
\modulesynopsis{Build a binary distribution as a Redhat RPM and SRPM}
Index: lib/libcsv.tex
===================================================================
--- lib/libcsv.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libcsv.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -64,9 +64,9 @@
class or one of the strings returned by the \function{list_dialects}
function. The other optional {}\var{fmtparam} keyword arguments can be
given to override individual formatting parameters in the current
-dialect. For more information about the dialect and formatting
+dialect. For full details about the dialect and formatting
parameters, see section~\ref{csv-fmt-params}, ``Dialects and Formatting
-Parameters'' for details of these parameters.
+Parameters''.
All data read are returned as strings. No automatic data type
conversion is performed.
@@ -96,10 +96,10 @@
of a subclass of the \class{Dialect} class or one of the strings
returned by the \function{list_dialects} function. The other optional
{}\var{fmtparam} keyword arguments can be given to override individual
-formatting parameters in the current dialect. For more information
+formatting parameters in the current dialect. For full details
about the dialect and formatting parameters, see
-section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters'' for
-details of these parameters. To make it as easy as possible to
+section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters''.
+To make it as easy as possible to
interface with modules which implement the DB API, the value
\constant{None} is written as the empty string. While this isn't a
reversible transformation, it makes it easier to dump SQL NULL data values
@@ -113,9 +113,8 @@
or Unicode object. The dialect can be specified either by passing a
sub-class of \class{Dialect}, or by \var{fmtparam} keyword arguments,
or both, with keyword arguments overriding parameters of the dialect.
-For more information about the dialect and formatting parameters, see
-section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters''
-for details of these parameters.
+For full details about the dialect and formatting parameters, see
+section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters''.
\end{funcdesc}
\begin{funcdesc}{unregister_dialect}{name}
@@ -197,12 +196,13 @@
\begin{classdesc}{excel}{}
The \class{excel} class defines the usual properties of an Excel-generated
-CSV file.
+CSV file. It is registered with the dialect name \code{'excel'}.
\end{classdesc}
\begin{classdesc}{excel_tab}{}
The \class{excel_tab} class defines the usual properties of an
-Excel-generated TAB-delimited file.
+Excel-generated TAB-delimited file. It is registered with the dialect name
+\code{'excel-tab'}.
\end{classdesc}
\begin{classdesc}{Sniffer}{}
@@ -345,6 +345,7 @@
\begin{memberdesc}[csv reader]{line_num}
The number of lines read from the source iterator. This is not the same
as the number of records returned, as records can span multiple lines.
+ \versionadded{2.5}
\end{memberdesc}
Index: lib/libsubprocess.tex
===================================================================
--- lib/libsubprocess.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libsubprocess.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -12,9 +12,6 @@
codes. This module intends to replace several other, older modules
and functions, such as:
-% XXX Should add pointers to this module to at least the popen2
-% and commands sections.
-
\begin{verbatim}
os.system
os.spawn*
Index: lib/libasyncore.tex
===================================================================
--- lib/libasyncore.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libasyncore.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -198,9 +198,11 @@
\end{methoddesc}
\begin{methoddesc}{bind}{address}
- Bind the socket to \var{address}. The socket must not already
- be bound. (The format of \var{address} depends on the address
- family --- see above.)
+ Bind the socket to \var{address}. The socket must not already be
+ bound. (The format of \var{address} depends on the address family
+ --- see above.) To mark the socket as re-usable (setting the
+ \constant{SO_REUSEADDR} option), call the \class{dispatcher}
+ object's \method{set_reuse_addr()} method.
\end{methoddesc}
\begin{methoddesc}{accept}{}
Index: lib/libdatetime.tex
===================================================================
--- lib/libdatetime.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libdatetime.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -1421,19 +1421,21 @@
varies across platforms. Regardless of platform, years before 1900
cannot be used.
-\subsection{Examples}
-
-\subsubsection{Creating Datetime Objects from Formatted Strings}
-
-The \class{datetime} class does not directly support parsing formatted time
-strings. You can use \function{time.strptime} to do the parsing and create
-a \class{datetime} object from the tuple it returns:
-
-\begin{verbatim}
->>> s = "2005-12-06T12:13:14"
->>> from datetime import datetime
->>> from time import strptime
->>> datetime(*strptime(s, "%Y-%m-%dT%H:%M:%S")[0:6])
-datetime.datetime(2005, 12, 6, 12, 13, 14)
-\end{verbatim}
-
+%%% This example is obsolete, since strptime is now supported by datetime.
+%
+% \subsection{Examples}
+%
+% \subsubsection{Creating Datetime Objects from Formatted Strings}
+%
+% The \class{datetime} class does not directly support parsing formatted time
+% strings. You can use \function{time.strptime} to do the parsing and create
+% a \class{datetime} object from the tuple it returns:
+%
+% \begin{verbatim}
+% >>> s = "2005-12-06T12:13:14"
+% >>> from datetime import datetime
+% >>> from time import strptime
+% >>> datetime(*strptime(s, "%Y-%m-%dT%H:%M:%S")[0:6])
+% datetime.datetime(2005, 12, 6, 12, 13, 14)
+% \end{verbatim}
+%
Index: lib/libbsddb.tex
===================================================================
--- lib/libbsddb.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libbsddb.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -19,21 +19,23 @@
3.3 thru 4.4.
\begin{seealso}
- \seeurl{http://pybsddb.sourceforge.net/}{The website with documentation
- for the \module{bsddb.db} python Berkeley DB interface that closely mirrors
- the Sleepycat object oriented interface provided in Berkeley DB 3 and 4.}
- \seeurl{http://www.sleepycat.com/}{Sleepycat Software produces the
- Berkeley DB library.}
+ \seeurl{http://pybsddb.sourceforge.net/}
+ {The website with documentation for the \module{bsddb.db}
+ Python Berkeley DB interface that closely mirrors the object
+ oriented interface provided in Berkeley DB 3 and 4.}
+
+ \seeurl{http://www.oracle.com/database/berkeley-db/}
+ {The Berkeley DB library.}
\end{seealso}
A more modern DB, DBEnv and DBSequence object interface is available in the
-\module{bsddb.db} module which closely matches the Sleepycat Berkeley DB C API
+\module{bsddb.db} module which closely matches the Berkeley DB C API
documented at the above URLs. Additional features provided by the
\module{bsddb.db} API include fine tuning, transactions, logging, and
multiprocess concurrent database access.
The following is a description of the legacy \module{bsddb} interface
-compatible with the old python bsddb module. Starting in Python 2.5 this
+compatible with the old Python bsddb module. Starting in Python 2.5 this
interface should be safe for multithreaded access. The \module{bsddb.db}
API is recommended for threading users as it provides better control.
Index: lib/libos.tex
===================================================================
--- lib/libos.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libos.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -361,6 +361,10 @@
errors), \code{None} is returned.
Availability: Macintosh, \UNIX, Windows.
+The \module{subprocess} module provides more powerful facilities for
+spawning new processes and retrieving their results; using that module
+is preferable to using this function.
+
\versionchanged[This function worked unreliably under Windows in
earlier versions of Python. This was due to the use of the
\cfunction{_popen()} function from the libraries provided with
@@ -375,8 +379,13 @@
Availability: Macintosh, \UNIX, Windows.
\end{funcdesc}
+There are a number of different \function{popen*()} functions that
+provide slightly different ways to create subprocesses. Note that the
+\module{subprocess} module is easier to use and more powerful;
+consider using that module before writing code using the
+lower-level \function{popen*()} functions.
-For each of the following \function{popen()} variants, if \var{bufsize} is
+For each of the \function{popen*()} variants, if \var{bufsize} is
specified, it specifies the buffer size for the I/O pipes.
\var{mode}, if provided, should be the string \code{'b'} or
\code{'t'}; on Windows this is needed to determine whether the file
@@ -1545,7 +1554,13 @@
\funcline{spawnve}{mode, path, args, env}
\funcline{spawnvp}{mode, file, args}
\funcline{spawnvpe}{mode, file, args, env}
-Execute the program \var{path} in a new process. If \var{mode} is
+Execute the program \var{path} in a new process.
+
+(Note that the \module{subprocess} module provides more powerful
+facilities for spawning new processes and retrieving their results;
+using that module is preferable to using these functions.)
+
+If \var{mode} is
\constant{P_NOWAIT}, this function returns the process ID of the new
process; if \var{mode} is \constant{P_WAIT}, returns the process's
exit code if it exits normally, or \code{-\var{signal}}, where
@@ -1682,6 +1697,10 @@
a non-native shell, consult your shell documentation.
Availability: Macintosh, \UNIX, Windows.
+
+The \module{subprocess} module provides more powerful facilities for
+spawning new processes and retrieving their results; using that module
+is preferable to using this function.
\end{funcdesc}
\begin{funcdesc}{times}{}
Index: lib/libfpectl.tex
===================================================================
--- lib/libfpectl.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libfpectl.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -7,6 +7,11 @@
\sectionauthor{Lee Busby}{busby1@llnl.gov}
\modulesynopsis{Provide control for floating point exception handling.}
+\note{The \module{fpectl} module is not built by default, and its usage
+ is discouraged and may be dangerous except in the hands of
+ experts. See also the section \ref{fpectl-limitations} on
+ limitations for more details.}
+
Most computers carry out floating point operations\index{IEEE-754}
in conformance with the so-called IEEE-754 standard.
On any real computer,
@@ -95,7 +100,7 @@
\end{verbatim}
-\subsection{Limitations and other considerations}
+\subsection{Limitations and other considerations \label{fpectl-limitations}}
Setting up a given processor to trap IEEE-754 floating point
errors currently requires custom code on a per-architecture basis.
Index: lib/libctypes.tex
===================================================================
--- lib/libctypes.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libctypes.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -1821,7 +1821,7 @@
\begin{quote}
\begin{verbatim}>>> from ctypes import c_int, WINFUNCTYPE, windll
>>> from ctypes.wintypes import HWND, LPCSTR, UINT
->>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, c_uint)
+>>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT)
>>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0)
>>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags)
>>>\end{verbatim}
Index: lib/liburlparse.tex
===================================================================
--- lib/liburlparse.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/liburlparse.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -142,7 +142,7 @@
\begin{funcdesc}{urljoin}{base, url\optional{, allow_fragments}}
Construct a full (``absolute'') URL by combining a ``base URL''
-(\var{base}) with a ``relative URL'' (\var{url}). Informally, this
+(\var{base}) with another URL (\var{url}). Informally, this
uses components of the base URL, in particular the addressing scheme,
the network location and (part of) the path, to provide missing
components in the relative URL. For example:
@@ -155,6 +155,20 @@
The \var{allow_fragments} argument has the same meaning and default as
for \function{urlparse()}.
+
+\note{If \var{url} is an absolute URL (that is, starting with \code{//}
+ or \code{scheme://}, the \var{url}'s host name and/or scheme
+ will be present in the result. For example:}
+
+\begin{verbatim}
+>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',
+... '//www.python.org/%7Eguido')
+'http://www.python.org/%7Eguido'
+\end{verbatim}
+
+If you do not want that behavior, preprocess
+the \var{url} with \function{urlsplit()} and \function{urlunsplit()},
+removing possible \em{scheme} and \em{netloc} parts.
\end{funcdesc}
\begin{funcdesc}{urldefrag}{url}
Index: lib/libpopen2.tex
===================================================================
--- lib/libpopen2.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libpopen2.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -11,10 +11,10 @@
input/output/error pipes and obtain their return codes under
\UNIX{} and Windows.
-Note that starting with Python 2.0, this functionality is available
-using functions from the \refmodule{os} module which have the same
-names as the factory functions here, but the order of the return
-values is more intuitive in the \refmodule{os} module variants.
+The \module{subprocess} module provides more powerful facilities for
+spawning new processes and retrieving their results. Using the
+\module{subprocess} module is preferable to using the \module{popen2}
+module.
The primary interface offered by this module is a trio of factory
functions. For each of these, if \var{bufsize} is specified,
@@ -184,3 +184,7 @@
separate threads to read each of the individual files provided by
whichever \function{popen*()} function or \class{Popen*} class was
used.
+
+\begin{seealso}
+ \seemodule{subprocess}{Module for spawning and managing subprocesses.}
+\end{seealso}
Index: lib/libsocket.tex
===================================================================
--- lib/libsocket.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libsocket.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -712,14 +712,15 @@
\end{methoddesc}
\begin{methoddesc}{server}{}
-Returns a string containing the ASN.1 distinguished name identifying the
-server's certificate. (See below for an example
-showing what distinguished names look like.)
+Returns a string describing the server's certificate.
+Useful for debugging purposes; do not parse the content of this string
+because its format can't be parsed unambiguously.
\end{methoddesc}
\begin{methoddesc}{issuer}{}
-Returns a string containing the ASN.1 distinguished name identifying the
-issuer of the server's certificate.
+Returns a string describing the issuer of the server's certificate.
+Useful for debugging purposes; do not parse the content of this string
+because its format can't be parsed unambiguously.
\end{methoddesc}
\subsection{Example \label{socket-example}}
Index: lib/libcommands.tex
===================================================================
--- lib/libcommands.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libcommands.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -12,6 +12,11 @@
return any output generated by the command and, optionally, the exit
status.
+The \module{subprocess} module provides more powerful facilities for
+spawning new processes and retrieving their results. Using the
+\module{subprocess} module is preferable to using the \module{commands}
+module.
+
The \module{commands} module defines the following functions:
@@ -51,3 +56,7 @@
>>> commands.getstatus('/bin/ls')
'-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls'
\end{verbatim}
+
+\begin{seealso}
+ \seemodule{subprocess}{Module for spawning and managing subprocesses.}
+\end{seealso}
Index: lib/libitertools.tex
===================================================================
--- lib/libitertools.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libitertools.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -474,8 +474,8 @@
return izip(mapping.iterkeys(), mapping.itervalues())
def nth(iterable, n):
- "Returns the nth item"
- return list(islice(iterable, n, n+1))
+ "Returns the nth item or raise IndexError"
+ return list(islice(iterable, n, n+1))[0]
def all(seq, pred=None):
"Returns True if pred(x) is true for every element in the iterable"
Index: lib/libfuncs.tex
===================================================================
--- lib/libfuncs.tex (.../tags/r25/Doc) (revision 52528)
+++ lib/libfuncs.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -791,7 +791,7 @@
\begin{verbatim}
class C(object):
- def __init__(self): self.__x = None
+ def __init__(self): self._x = None
def getx(self): return self._x
def setx(self, value): self._x = value
def delx(self): del self._x
Index: api/concrete.tex
===================================================================
--- api/concrete.tex (.../tags/r25/Doc) (revision 52528)
+++ api/concrete.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -602,15 +602,15 @@
\end{cfuncdesc}
\begin{cfuncdesc}{PyObject*}{PyString_FromString}{const char *v}
- Return a new string object with the value \var{v} on success, and
- \NULL{} on failure. The parameter \var{v} must not be \NULL{}; it
- will not be checked.
+ Return a new string object with a copy of the string \var{v} as value
+ on success, and \NULL{} on failure. The parameter \var{v} must not be
+ \NULL{}; it will not be checked.
\end{cfuncdesc}
\begin{cfuncdesc}{PyObject*}{PyString_FromStringAndSize}{const char *v,
Py_ssize_t len}
- Return a new string object with the value \var{v} and length
- \var{len} on success, and \NULL{} on failure. If \var{v} is
+ Return a new string object with a copy of the string \var{v} as value
+ and length \var{len} on success, and \NULL{} on failure. If \var{v} is
\NULL{}, the contents of the string are uninitialized.
\end{cfuncdesc}
@@ -2879,10 +2879,10 @@
Various date and time objects are supplied by the \module{datetime}
module. Before using any of these functions, the header file
\file{datetime.h} must be included in your source (note that this is
-not include by \file{Python.h}), and macro \cfunction{PyDateTime_IMPORT()}
-must be invoked. The macro arranges to put a pointer to a C structure
-in a static variable \code{PyDateTimeAPI}, which is used by the following
-macros.
+not included by \file{Python.h}), and the macro
+\cfunction{PyDateTime_IMPORT} must be invoked. The macro puts a
+pointer to a C structure into a static variable,
+\code{PyDateTimeAPI}, that is used by the following macros.
Type-check macros:
Index: ref/ref3.tex
===================================================================
--- ref/ref3.tex (.../tags/r25/Doc) (revision 52528)
+++ ref/ref3.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -379,6 +379,41 @@
\end{description} % Sequences
+
+\item[Set types]
+These represent unordered, finite sets of unique, immutable objects.
+As such, they cannot be indexed by any subscript. However, they can be
+iterated over, and the built-in function \function{len()} returns the
+number of items in a set. Common uses for sets are
+fast membership testing, removing duplicates from a sequence, and
+computing mathematical operations such as intersection, union, difference,
+and symmetric difference.
+\bifuncindex{len}
+\obindex{set type}
+
+For set elements, the same immutability rules apply as for dictionary
+keys. Note that numeric types obey the normal rules for numeric
+comparison: if two numbers compare equal (e.g., \code{1} and
+\code{1.0}), only one of them can be contained in a set.
+
+There are currently two intrinsic set types:
+
+\begin{description}
+
+\item[Sets]
+These\obindex{set} represent a mutable set. They are created by the
+built-in \function{set()} constructor and can be modified afterwards
+by several methods, such as \method{add()}.
+
+\item[Frozen sets]
+These\obindex{frozenset} represent an immutable set. They are created by
+the built-in \function{frozenset()} constructor. As a frozenset is
+immutable and hashable, it can be used again as an element of another set,
+or as a dictionary key.
+
+\end{description} % Set types
+
+
\item[Mappings]
These represent finite sets of objects indexed by arbitrary index sets.
The subscript notation \code{a[k]} selects the item indexed
Index: tut/tut.tex
===================================================================
--- tut/tut.tex (.../tags/r25/Doc) (revision 52528)
+++ tut/tut.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -2855,7 +2855,7 @@
*}? Ideally, one would hope that this somehow goes out to the
filesystem, finds which submodules are present in the package, and
imports them all. Unfortunately, this operation does not work very
-well on Mac and Windows platforms, where the filesystem does not
+well on Windows platforms, where the filesystem does not
always have accurate information about the case of a filename! On
these platforms, there is no guaranteed way to know whether a file
\file{ECHO.PY} should be imported as a module \module{echo},
@@ -3060,6 +3060,7 @@
8 64 512
9 81 729
10 100 1000
+
>>> for x in range(1,11):
... print '%2d %3d %4d' % (x, x*x, x*x*x)
...
@@ -3075,8 +3076,9 @@
10 100 1000
\end{verbatim}
-(Note that one space between each column was added by the way
-\keyword{print} works: it always adds spaces between its arguments.)
+(Note that in the first example, one space between each column was
+added by the way \keyword{print} works: it always adds spaces between
+its arguments.)
This example demonstrates the \method{rjust()} method of string objects,
which right-justifies a string in a field of a given width by padding
@@ -3539,7 +3541,7 @@
But use of \code{.args} is discouraged. Instead, the preferred use is to pass
a single argument to an exception (which can be a tuple if multiple arguments
-are needed) and have it bound to the \code{message} attribute. One my also
+are needed) and have it bound to the \code{message} attribute. One may also
instantiate an exception first before raising it and add any attributes to it
as desired.
Index: inst/inst.tex
===================================================================
--- inst/inst.tex (.../tags/r25/Doc) (revision 52528)
+++ inst/inst.tex (.../branches/release25-maint/Doc) (revision 52528)
@@ -632,7 +632,7 @@
installation base directory when you run the setup script. For example,
\begin{verbatim}
-python setup.py --install-base=/tmp
+python setup.py install --install-base=/tmp
\end{verbatim}
would install pure modules to \filevar{/tmp/python/lib} in the first
|