[issue35904] Add statistics.fmean(seq)

2019-04-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 7280048690244e73b13f4f68b96c244bcb5434e8 by Raymond Hettinger in branch 'master': bpo-35904: Add missing fmean() entry to the summary table (GH-12919) https://github.com/python/cpython/commit/7280048690244e73b13f4f68b96c244bcb5434e8

[issue35904] Add statistics.fmean(seq)

2019-04-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +12845 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35904] Add statistics.fmean(seq)

2019-02-21 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue35904] Add statistics.fmean(seq)

2019-02-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 47d9987247bcc45983a6d51fd1ae46d5d356d0f8 by Raymond Hettinger in branch 'master': bpo-35904: Add statistics.fmean() (GH-11892) https://github.com/python/cpython/commit/47d9987247bcc45983a6d51fd1ae46d5d356d0f8 --

[issue35904] Add statistics.fmean(seq)

2019-02-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: PR looks good to me, thanks Raymond. Just at the moment I'm having problems with my internet connection leading to technical difficulties with Github. Hopefully I can resolve this soon. -- ___ Python tracker

[issue35904] Add statistics.fmean(seq)

2019-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Yes please! I'm happy with the name fmean Okay, the PR is ready. -- ___ Python tracker ___

[issue35904] Add statistics.fmean(seq)

2019-02-16 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +11920 stage: -> patch review ___ Python tracker ___ ___

[issue35904] Add statistics.fmean(seq)

2019-02-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Would you like me to submit a PR with docs and tests? Yes please! I'm happy with the name fmean. -- ___ Python tracker ___

[issue35904] Add statistics.fmean(seq)

2019-02-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, fabs() and fmod() are other examples of where "f" indicates a function specialized to convert inputs to floats, perform floating point math, and return a float. -- ___ Python tracker

[issue35904] Add statistics.fmean(seq)

2019-02-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: Would you like me to submit a PR with docs and tests? -- ___ Python tracker ___ ___

[issue35904] Add statistics.fmean(seq)

2019-02-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 from me as well. I like your count() solution because 1) it gives the same answer for both an iterator and for an iterable 2) it preserves the memory friendly characteristics of iterators, 3), it is still reasonably fast, and 4) the function

[issue35904] Add statistics.fmean(seq)

2019-02-08 Thread Mark Dickinson
Mark Dickinson added the comment: No further bikeshedding on the name from me; +1 on whatever you decide on. :-) -- ___ Python tracker ___

[issue35904] Add statistics.fmean(seq)

2019-02-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oh, I seem to have accidentally reverted the change of title. Sorry, that was definitely not intended and I don't know how it happened. But now that it has, I'm not going to change it until we have a decision on a name. --

[issue35904] Add statistics.fmean(seq)

2019-02-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: > On my current 3.8 build, this code given an approx 500x speed-up On my system, I only get a 30x speed-up using your timeit code. Using ints instead of random floats, I only get a 9x speed-up. This just goes to show how sensitive these timing results are

[issue35904] Add statistics.fmean(seq)

2019-02-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: >>def fmean(seq: Sequence[float]) -> float: >>return math.fsum(seq) / len(seq) > > Is it intentional that this doesn't support iterators? Since we need both the sum and the length, this seemed like a good starting point. Also, the existing

[issue35904] Add statistics.fmean(seq)

2019-02-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: >def fmean(seq: Sequence[float]) -> float: >return math.fsum(seq) / len(seq) Is it intentional that this doesn't support iterators? -- ___ Python tracker

[issue35904] Add statistics.fmean(seq)

2019-02-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: In the PEP, I did say that I was making no attempt to compete with numpy for speed, and that correctness was more important than speed. That doesn't mean I don't care about speed. Nor do I necessarily care about absolute precision when given nothing but

[issue35904] Add statistics.fmean(seq)

2019-02-06 Thread Mark Dickinson
Mark Dickinson added the comment: Double-checking my own assertions: here's an example of a list xs of floats for which `fsum(xs) / len(xs)` is out by more than 1 ulp. (Obtained simply by checking a few lists of random.random() outputs; it's probably possible to construct something more

[issue35904] Add statistics.fmean(seq)

2019-02-06 Thread Mark Dickinson
Mark Dickinson added the comment: > Are you saying that "fsum(seq) / len(seq)" is incorrect because on some > older builds there is a rare possibility of an error of 1 unit in the last > place? Just to be clear, it's not that rare a possibility, and it's not restricted to older builds. I

[issue35904] Add statistics.fmean(seq)

2019-02-06 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35904] Add statistics.fmean(seq)

2019-02-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Correctness over speed. Are you saying that "fsum(seq) / len(seq)" is incorrect because on some older builds there is a rare possibility of an error of 1 unit in the last place? Just about everyone who uses this module will not care one whit about

[issue35904] Add statistics.fmean(seq)

2019-02-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: Correct me if I'm wrong, but at least initially, the first listed goal of statistics (per the PEP) was: "Correctness over speed. It is easier to speed up a correct but slow function than to correct a fast but buggy one." numpy already exists for people who

[issue35904] Add statistics.fmean(seq)

2019-02-05 Thread Raymond Hettinger
New submission from Raymond Hettinger : The current mean() function makes heroic efforts to achieve last bit accuracy and when possible to retain the data type of the input. What is needed is an alternative that has a simpler signature, that is much faster, that is highly accurate without