[Python-ideas] Pre-PEP: adding a statistics module to Python

Ryan rymg19 at gmail.com
Tue Aug 6 18:36:51 CEST 2013


That could easily be fixed:

variance(list(iter(data)))

It could take place on the inside.

Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:

>On 2 August 2013 18:45, Steven D'Aprano <steve at pearwood.info> wrote:
>> I have raised an issue on the tracker to add a statistics module to
>Python's
>> standard library:
>>
>> http://bugs.python.org/issue18606
>>
>> and have been asked to write a PEP. Attached is my draft PEP.
>Feedback is
>> requested, thanks in advance.
>
>I have another query/suggestion for the statistics module.
>
>Taking the example from the PEP:
>
>>>> from statistics import *
>>>> data = [1, 2, 4, 5, 8]
>>>> data = [x+1e12 for x in data]
>>>> variance(data)
>7.5
>
>However:
>
>>>> variance(iter(data))
>7.4999542236328125
>
>Okay so that's a small difference and it's unlikely to upset many
>people. But being something of a numerical obsessive I do often get
>upset about things like this. It's not that I mind the size of the
>error but rather that I dislike having the calculation implicitly
>changed. I want to think that it doesn't matter whether I pass an
>iterator or a list because either I get an error or I get the same
>result.
>


>
>
>Oscar
>_______________________________________________
>Python-ideas mailing list
>Python-ideas at python.org
>http://mail.python.org/mailman/listinfo/python-ideas

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.


More information about the Python-ideas mailing list