gerion added the comment:

My use case is some side data somehow connected to the statistical relevant 
data.
(I think, this is more less a similar use case as with the min and max 
function.)

A few examples:

The datastructure is a list of tuples: (score, [list of people that have this 
score])
```
median = median_low([(1, ['Anna']), (3, ['Paul', 'Henry']), (4, ['Kate'])], 
key=lambda elem: elem[0])
for name in median[1]:
    print(f"{name} is one of the people that reach the median score.")
```
or you can enumerate:
```
data = [1, 3, 4]
median = median_low(enumerate(data), key=lambda elem: elem[1])
print(f"median is at position {median[0]}")
```
With the keyword argument, the input can also be a list of self defined 
objects, where the median make sense on some member variable or function, etc.:
```
>>> median_low(list_of_self_defined_objects, key=lambda elem: elem.get_score())
```

----------

_______________________________________
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

Reply via email to