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

Michele Lacchia michelelacchia at gmail.com
Tue Aug 6 21:44:49 CEST 2013


Yes but then you lose all the advantages of iterators. What's the point in
that?
Furthermore it's not guaranteed that you can always converting an iterator
into a list. As it has already been said, you could run out of memory, for
instance.
Il giorno 06/ago/2013 18:37, "Ryan" <rymg19 at gmail.com> ha scritto:

> 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.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130806/fb4c1e3c/attachment.html>


More information about the Python-ideas mailing list