The PEP and code look generally good to me.

I think the API for median and its variants deserves some wider discussion: the reference implementation has a callable 'median', and variant callables 'median.low', 'median.high', 'median.grouped'.  The pattern of attaching the variant callables as attributes on the main callable is unusual, and isn't something I've seen elsewhere in the standard library.  I'd like to see some explanation in the PEP for why it's done this way.  (There was already some discussion of this on the issue, but that was more centered around the implementation than the API.)

I'd propose two alternatives for this:  either have separate functions 'median', 'median_low', 'median_high', etc., or have a single function 'median' with a "method" argument that takes a string specifying computation using a particular method.  I don't see a really good reason to deviate from standard patterns here, and fear that users would find the current API surprising.


On Thu, Aug 15, 2013 at 2:25 AM, Steven D'Aprano <> wrote:
Hi all,

I have raised a tracker item and PEP for adding a statistics module to the standard library:

There has been considerable discussion on python-ideas, which is now reflected by the PEP. I've signed the Contributor Agreement, and submitted a patch containing updated code and tests. The tests aren't yet integrated with the test runner but are runnable manually.

Can I request that people please look at this issue, with an aim to ruling on the PEP and (hopefully) adding the module to 3.4 before feature freeze? If it is accepted, I am willing to be primary maintainer for this module in the future.


Python-Dev mailing list