Add (past) discussion points to PEP 450.

This commit is contained in:
Guido van Rossum 2013-09-18 07:55:22 -07:00
parent 23983f0a13
commit d0c939ef39
1 changed files with 41 additions and 3 deletions

View File

@ -364,10 +364,48 @@ What Should Be The Name Of The Module?
(described as "too C-like"). (described as "too C-like").
Previous Discussions Discussion And Resolved Issues
This proposal has been previously discussed here[21]. This proposal has been previously discussed here[21].
A number of design issues were resolved during the discussion on
Python-Ideas and the initial code review. There was a lot of concern
about the addition of yet another ``sum`` function to the standard
library, see the FAQs below for more details. In addition, the
initial implementation of ``sum`` suffered from some rounding issues
and other design problems when dealing with Decimals. Oscar
Benjamin's assistance in resolving this was invaluable.
Another issue was the handling of data in the form of iterators. The
first implementation of variance silently swapped between a one- and
two-pass algorithm, depending on whether the data was in the form of
an iterator or sequence. This proved to be a design mistake, as the
calculated variance could differ slightly depending on the algorithm
used, and ``variance`` etc. were changed to internally generate a list
and always use the more accurate two-pass implementation.
One controversial design involved the functions to calculate median,
which were implemented as attributes on the ``median`` callable, e.g.
``median``, ``median.low``, ``median.high`` etc. Although there is
at least one existing use of this style in the standard library, in
``unittest.mock``, the code reviewers felt that this was too unusual
for the standard library. Consequently, the design has been changed
to a more traditional design of separate functions with a pseudo-
namespace naming convention, ``median_low``, ``median_high``, etc.
Another issue that was of concern to code reviewers was the existence
of a function calculating the sample mode of continuous data, with
some people questioning the choice of algorithm, and whether it was
a sufficiently common need to be included. So it was dropped from
the API, and ``mode`` now implements only the basic schoolbook
algorithm based on counting unique values.
Another significant point of discussion was calculating statistics of
timedelta objects. Although the statistics module will not directly
support timedelta objects, it is possible to support this use-case by
converting them to numbers first using the ``timedelta.total_seconds``
method.
Frequently Asked Questions Frequently Asked Questions
@ -392,7 +430,7 @@ Frequently Asked Questions
- math.fsum is high-precision, but coerces all arguments to float. - math.fsum is high-precision, but coerces all arguments to float.
There is some interest in "fixing" one or the other of the existing There was some interest in "fixing" one or the other of the existing
sums. If this occurs before 3.4 feature-freeze, the decision to keep sums. If this occurs before 3.4 feature-freeze, the decision to keep
statistics.sum can be re-considered. statistics.sum can be re-considered.