import functools
import itertools


def nlargest_list2(n, iterable):
    """Return the n largest items in the given iterable."""
    # Quite naïve method, keeping its own list of the n largest numbers at
    # every time and keeping track of the smallest item and its index in the
    # list for future replacement.
    get_min_index_value = functools.partial(min, key=lambda x: x[1])
    largest = iterable[:n]
    min_index, min_value = get_min_index_value(enumerate(largest))
    for i in itertools.islice(iterable, n, None):
        if i > min_value:
            largest[min_index] = i
            min_index, min_value = get_min_index_value(enumerate(largest))
    largest.sort()
    return largest