Is there some function which would return me the N highest elements from some list?
I.e. if max(l)
returns the single highest element, sth. like max(l, count=10)
would return me a list of the 10 highest numbers (or less if l
is smaller).
Or what would be an efficient easy way to get these? (Except the obvious canonical implementation; also, no such things which involve sorting the whole list first because that would be inefficient compared to the canonical solution.)