(n, iterable)
return result
Find the n largest elements in a dataset.

    Equivalent to:  sorted(iterable, reverse=True)[:n]
Find the n largest elements in a dataset.
Find the n largest elements in a dataset .
def nlargest(n, iterable):
    """Find the n largest elements in a dataset.

    Equivalent to:  sorted(iterable, reverse=True)[:n]
    """
    if n < 0:
        return []
    it = iter(iterable)
    result = list(islice(it, n))
    if not result:
        return result
    heapify(result)
    _heappushpop = heappushpop
    for elem in it:
        _heappushpop(result, elem)
    result.sort(reverse=True)
    return result
def nlargest ( n , iterable ) : if n < 0 : return [ ] it = iter ( iterable ) result = list ( islice ( it , n ) ) if not result : return result heapify ( result ) _heappushpop = heappushpop for elem in it : _heappushpop ( result , elem ) result . sort ( reverse = True ) return result