Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-100425: Note improved commutativity in sum(). #107785

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

.. function:: abs(x)

Return the absolute value of a number. The argument may be an

Check warning on line 59 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: __abs__
integer, a floating point number, or an object implementing :meth:`__abs__`.
If the argument is a complex number, its magnitude is returned.

Expand Down Expand Up @@ -231,7 +231,7 @@

.. function:: callable(object)

Return :const:`True` if the *object* argument appears callable,

Check warning on line 234 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: __call__
:const:`False` if not. If this returns ``True``, it is still possible that a
call fails, but if it is ``False``, calling *object* will never succeed.
Note that classes are callable (calling a class returns a new instance);
Expand Down Expand Up @@ -318,7 +318,7 @@
non-zero integer then the *flags* argument is it -- the flags (future
features and compiler options) in the surrounding code are ignored.

Compiler options and future statements are specified by bits which can be

Check warning on line 321 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:attr reference target not found: __future__._Feature.compiler_flag

Check warning on line 321 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:class reference target not found: __future__._Feature
bitwise ORed together to specify multiple options. The bitfield required to
specify a given future feature can be found as the
:attr:`~__future__._Feature.compiler_flag` attribute on the
Expand Down Expand Up @@ -432,12 +432,12 @@
Without arguments, return the list of names in the current local scope. With an
argument, attempt to return a list of valid attributes for that object.

If the object has a method named :meth:`__dir__`, this method will be called and

Check warning on line 435 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: __dir__

Check warning on line 435 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:func reference target not found: __getattr__

Check warning on line 435 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:func reference target not found: __getattribute__
must return the list of attributes. This allows objects that implement a custom
:func:`__getattr__` or :func:`__getattribute__` function to customize the way
:func:`dir` reports their attributes.

If the object does not provide :meth:`__dir__`, the function tries its best to

Check warning on line 440 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: __dir__

Check warning on line 440 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:func reference target not found: __getattr__
gather information from the object's :attr:`~object.__dict__` attribute, if defined, and
from its type object. The resulting list is not necessarily complete and may
be inaccurate when the object has a custom :func:`__getattr__`.
Expand Down Expand Up @@ -660,7 +660,7 @@
input must conform to the ``floatvalue`` production rule in the following
grammar, after leading and trailing whitespace characters are removed:

.. productionlist:: float

Check warning on line 663 in Doc/library/functions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

'token' reference target not found: float:digit
sign: "+" | "-"
infinity: "Infinity" | "inf"
nan: "nan"
Expand Down Expand Up @@ -1752,7 +1752,7 @@
The *start* parameter can be specified as a keyword argument.

.. versionchanged:: 3.12 Summation of floats switched to an algorithm
that gives higher accuracy on most builds.
that gives higher accuracy and better commutativity on most builds.


.. class:: super()
Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ Other Language Changes
* :class:`slice` objects are now hashable, allowing them to be used as dict keys and
set items. (Contributed by Will Bradshaw, Furkan Onder, and Raymond Hettinger in :gh:`101264`.)

* :func:`sum` now uses Neumaier summation to improve accuracy when summing
floats or mixed ints and floats.
* :func:`sum` now uses Neumaier summation to improve accuracy and commutativity
when summing floats or mixed ints and floats.
(Contributed by Raymond Hettinger in :gh:`100425`.)

* Exceptions raised in a typeobject's ``__set_name__`` method are no longer
Expand Down
Loading