[issue30999] statistics module: add "key" keyword argument to median, mode, ...

Raymond Hettinger report at bugs.python.org
Mon Jul 31 05:41:31 EDT 2017


Raymond Hettinger added the comment:

> I don't think it makes sense to add key arguments to mode, mean,
> variance etc. I'm having trouble thinking of what that would
> even mean

I concur.  This proposal bends the concept of a key-function to where it is no longer obvious what it does.

> I've given this some more thought, and I think that a "key"
> argument would make sense for a general selection function.

Yes, that would make sense:

    select(A, k, key=somefunc) == sorted(A, key=somefunc)[k]

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30999>
_______________________________________


More information about the Python-bugs-list mailing list