New submission from gerion: With Python 3.4 the statistics module was added. It would be cool, if the functions: median_low() median_high() mode() would have a "key" keyword argument, just like in max() and min(): ``` >>> median_low([(1, 2), (3, 3), (4, 1)], key=lambda elem: elem[0]) (3, 3) ``` This functions always choose a specific element of the list, so a "key" argument is meaningful.
Maybe such a parameter makes sense for mean() as well, if the return value always is the result itself, but this is another point: ``` >>> mean([(1, 2), (3, 3), (4, 1)], key=lambda elem: elem[0]) 2.6666666666666665 ``` ---------- components: Library (Lib) messages: 298918 nosy: gerion priority: normal severity: normal status: open title: statistics module: add "key" keyword argument to median, mode, ... type: enhancement versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30999> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com