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

Skip to content

Commit b58dda7

Browse files
committed
Merged revisions 68633,68648,68667,68706,68718,68720-68721,68724-68727,68739 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r68633 | thomas.heller | 2009-01-16 12:53:44 -0600 (Fri, 16 Jan 2009) | 3 lines Change an example in the docs to avoid a mistake when the code is copy pasted and changed afterwards. ........ r68648 | benjamin.peterson | 2009-01-16 22:28:57 -0600 (Fri, 16 Jan 2009) | 1 line use enumerate ........ r68667 | amaury.forgeotdarc | 2009-01-17 14:18:59 -0600 (Sat, 17 Jan 2009) | 3 lines #4077: No need to append \n when calling Py_FatalError + fix a declaration to make it match the one in pythonrun.h ........ r68706 | benjamin.peterson | 2009-01-17 19:28:46 -0600 (Sat, 17 Jan 2009) | 1 line fix grammar ........ r68718 | georg.brandl | 2009-01-18 04:42:35 -0600 (Sun, 18 Jan 2009) | 1 line #4976: union() and intersection() take multiple args, but talk about "the other". ........ r68720 | georg.brandl | 2009-01-18 04:45:22 -0600 (Sun, 18 Jan 2009) | 1 line #4974: fix redundant mention of lists and tuples. ........ r68721 | georg.brandl | 2009-01-18 04:48:16 -0600 (Sun, 18 Jan 2009) | 1 line #4914: trunc is in math. ........ r68724 | georg.brandl | 2009-01-18 07:24:10 -0600 (Sun, 18 Jan 2009) | 1 line #4979: correct result range for some random functions. ........ r68725 | georg.brandl | 2009-01-18 07:47:26 -0600 (Sun, 18 Jan 2009) | 1 line #4857: fix augmented assignment target spec. ........ r68726 | georg.brandl | 2009-01-18 08:41:52 -0600 (Sun, 18 Jan 2009) | 1 line #4923: clarify what was added. ........ r68727 | georg.brandl | 2009-01-18 12:25:30 -0600 (Sun, 18 Jan 2009) | 1 line #4986: augassigns are not expressions. ........ r68739 | benjamin.peterson | 2009-01-18 15:11:38 -0600 (Sun, 18 Jan 2009) | 1 line fix test that wasn't working as expected #4990 ........
1 parent b547979 commit b58dda7

13 files changed

Lines changed: 48 additions & 45 deletions

File tree

Doc/library/ctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2406,10 +2406,10 @@ other data types containing pointer type fields.
24062406
("hreftype", HREFTYPE)]
24072407

24082408
class TYPEDESC(Structure):
2409+
_anonymous_ = ("u",)
24092410
_fields_ = [("u", _U),
24102411
("vt", VARTYPE)]
24112412

2412-
_anonymous_ = ("u",)
24132413

24142414
The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field
24152415
specifies which one of the union fields is valid. Since the ``u`` field

Doc/library/datetime.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,10 +1494,6 @@ For :class:`date` objects, the format codes for hours, minutes, seconds, and
14941494
microseconds should not be used, as :class:`date` objects have no such
14951495
values. If they're used anyway, ``0`` is substituted for them.
14961496

1497-
:class:`time` and :class:`datetime` objects support a ``%f`` format code
1498-
which expands to the number of microseconds in the object, zero-padded on
1499-
the left to six places.
1500-
15011497
For a naive object, the ``%z`` and ``%Z`` format codes are replaced by empty
15021498
strings.
15031499

@@ -1616,7 +1612,9 @@ Notes:
16161612
(1)
16171613
When used with the :func:`strptime` function, the ``%f`` directive
16181614
accepts from one to six digits and zero pads on the right. ``%f`` is
1619-
an extension to the set of format characters in the C standard.
1615+
an extension to the set of format characters in the C standard (but
1616+
implemented separately in datetime objects, and therefore always
1617+
available).
16201618

16211619
(2)
16221620
When used with the :func:`strptime` function, the ``%p`` directive only affects

Doc/library/random.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,22 @@ be found in any statistics text.
149149

150150
.. function:: uniform(a, b)
151151

152-
Return a random floating point number *N* such that ``a <= N < b`` for
153-
``a <= b`` and ``b <= N < a`` for ``b < a``.
152+
Return a random floating point number *N* such that ``a <= N <= b`` for
153+
``a <= b`` and ``b <= N <= a`` for ``b < a``.
154154

155155

156156
.. function:: triangular(low, high, mode)
157157

158-
Return a random floating point number *N* such that ``low <= N < high`` and
158+
Return a random floating point number *N* such that ``low <= N <= high`` and
159159
with the specified *mode* between those bounds. The *low* and *high* bounds
160160
default to zero and one. The *mode* argument defaults to the midpoint
161161
between the bounds, giving a symmetric distribution.
162162

163163

164164
.. function:: betavariate(alpha, beta)
165165

166-
Beta distribution. Conditions on the parameters are ``alpha > 0`` and ``beta >
167-
0``. Returned values range between 0 and 1.
166+
Beta distribution. Conditions on the parameters are ``alpha > 0`` and
167+
``beta > 0``. Returned values range between 0 and 1.
168168

169169

170170
.. function:: expovariate(lambd)
@@ -178,14 +178,15 @@ be found in any statistics text.
178178

179179
.. function:: gammavariate(alpha, beta)
180180

181-
Gamma distribution. (*Not* the gamma function!) Conditions on the parameters
182-
are ``alpha > 0`` and ``beta > 0``.
181+
Gamma distribution. (*Not* the gamma function!) Conditions on the
182+
parameters are ``alpha > 0`` and ``beta > 0``.
183183

184184

185185
.. function:: gauss(mu, sigma)
186186

187-
Gaussian distribution. *mu* is the mean, and *sigma* is the standard deviation.
188-
This is slightly faster than the :func:`normalvariate` function defined below.
187+
Gaussian distribution. *mu* is the mean, and *sigma* is the standard
188+
deviation. This is slightly faster than the :func:`normalvariate` function
189+
defined below.
189190

190191

191192
.. function:: lognormvariate(mu, sigma)

Doc/library/stdtypes.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -343,19 +343,19 @@ Notes:
343343
All :class:`numbers.Real` types (:class:`int` and
344344
:class:`float`) also include the following operations:
345345

346-
+--------------------+--------------------------------+--------+
347-
| Operation | Result | Notes |
348-
+====================+================================+========+
349-
| ``trunc(x)`` | *x* truncated to Integral | |
350-
+--------------------+--------------------------------+--------+
351-
| ``round(x[, n])`` | *x* rounded to n digits, | |
352-
| | rounding half to even. If n is | |
353-
| | omitted, it defaults to 0. | |
354-
+--------------------+--------------------------------+--------+
355-
| ``math.floor(x)`` | the greatest Integral <= *x* | |
356-
+--------------------+--------------------------------+--------+
357-
| ``math.ceil(x)`` | the least Integral >= *x* | |
358-
+--------------------+--------------------------------+--------+
346+
+--------------------+------------------------------------+--------+
347+
| Operation | Result | Notes |
348+
+====================+====================================+========+
349+
| ``math.trunc(x)`` | *x* truncated to Integral | |
350+
+--------------------+------------------------------------+--------+
351+
| ``round(x[, n])`` | *x* rounded to n digits, | |
352+
| | rounding half to even. If n is | |
353+
| | omitted, it defaults to 0. | |
354+
+--------------------+------------------------------------+--------+
355+
| ``math.floor(x)`` | the greatest integral float <= *x* | |
356+
+--------------------+------------------------------------+--------+
357+
| ``math.ceil(x)`` | the least integral float >= *x* | |
358+
+--------------------+------------------------------------+--------+
359359

360360
For additional numeric operations see the :mod:`math` and :mod:`cmath`
361361
modules.
@@ -595,10 +595,10 @@ Sequence Types --- :class:`str`, :class:`bytes`, :class:`bytearray`, :class:`lis
595595
==================================================================================================================
596596

597597
There are six sequence types: strings, byte sequences (:class:`bytes` objects),
598-
byte arrays (:class:`bytearray` objects), lists, tuples, and range objects.
598+
byte arrays (:class:`bytearray` objects), lists, tuples, and range objects. For
599+
other containers see the built in :class:`dict` and :class:`set` classes, and
600+
the :mod:`collections` module.
599601

600-
For other containers see the built-in :class:`dict`, :class:`list`,
601-
:class:`set`, and :class:`tuple` classes, and the :mod:`collections` module.
602602

603603
.. index::
604604
object: sequence
@@ -1623,12 +1623,12 @@ The constructors for both classes work the same:
16231623
.. method:: union(other, ...)
16241624
set | other | ...
16251625

1626-
Return a new set with elements from both sets.
1626+
Return a new set with elements from the set and all others.
16271627

16281628
.. method:: intersection(other, ...)
16291629
set & other & ...
16301630

1631-
Return a new set with elements common to both sets.
1631+
Return a new set with elements common to the set and all others.
16321632

16331633
.. method:: difference(other, ...)
16341634
set - other - ...

Doc/reference/datamodel.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ Sequences
317317
slicing notations can be used as the target of assignment and :keyword:`del`
318318
(delete) statements.
319319

320-
There is currently a single intrinsic mutable sequence type:
320+
There are currently two intrinsic mutable sequence types:
321321

322322
Lists
323323
.. index:: object: list
@@ -1777,13 +1777,13 @@ left undefined.
17771777
object.__ixor__(self, other)
17781778
object.__ior__(self, other)
17791779

1780-
These methods are called to implement the augmented arithmetic operations
1780+
These methods are called to implement the augmented arithmetic assignments
17811781
(``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, ``>>=``,
17821782
``&=``, ``^=``, ``|=``). These methods should attempt to do the operation
17831783
in-place (modifying *self*) and return the result (which could be, but does
17841784
not have to be, *self*). If a specific method is not defined, the augmented
1785-
operation falls back to the normal methods. For instance, to evaluate the
1786-
expression ``x += y``, where *x* is an instance of a class that has an
1785+
assignment falls back to the normal methods. For instance, to execute the
1786+
statement ``x += y``, where *x* is an instance of a class that has an
17871787
:meth:`__iadd__` method, ``x.__iadd__(y)`` is called. If *x* is an instance
17881788
of a class that does not define a :meth:`__iadd__` method, ``x.__add__(y)``
17891789
and ``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``.

Doc/reference/simple_stmts.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ Augmented assignment is the combination, in a single statement, of a binary
246246
operation and an assignment statement:
247247

248248
.. productionlist::
249-
augmented_assignment_stmt: `target` `augop` (`expression_list` | `yield_expression`)
249+
augmented_assignment_stmt: `augtarget` `augop` (`expression_list` | `yield_expression`)
250+
augtarget: `identifier` | `attributeref` | `subscription` | `slicing`
250251
augop: "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="
251252
: | ">>=" | "<<=" | "&=" | "^=" | "|="
252253

Doc/tools/rstlint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#
77
# 01/2009, Georg Brandl
88

9+
# TODO: - wrong versions in versionadded/changed
10+
# - wrong markup after versionchanged directive
11+
912
from __future__ import with_statement
1013

1114
import os

Lib/inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,8 +881,8 @@ def formatargandannotation(arg):
881881
specs = []
882882
if defaults:
883883
firstdefault = len(args) - len(defaults)
884-
for i in range(len(args)):
885-
spec = strseq(args[i], formatargandannotation, join)
884+
for i, arg in enumerate(args):
885+
spec = strseq(arg, formatargandannotation, join)
886886
if defaults and i >= firstdefault:
887887
spec = spec + formatvalue(defaults[i - firstdefault])
888888
specs.append(spec)

Lib/test/test_codeccallbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ def test_badhandlerresults(self):
592592
encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15")
593593

594594
for res in results:
595-
codecs.register_error("test.badhandler", lambda: res)
595+
codecs.register_error("test.badhandler", lambda x: res)
596596
for enc in encs:
597597
self.assertRaises(
598598
TypeError,

Modules/_ctypes/libffi_msvc/ffi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/* ffi_prep_args is called by the assembly routine once stack space
3535
has been allocated for the function's arguments */
3636

37-
extern void Py_FatalError(char *msg);
37+
extern void Py_FatalError(const char *msg);
3838

3939
/*@-exportheader@*/
4040
void ffi_prep_args(char *stack, extended_cif *ecif)

0 commit comments

Comments
 (0)