Iteratively extending a list Is there a way to collapse multiple_get into as few lines as possible?

def single_get(target):
    return [some list of objects] # might be an empty list 

def multiple_get(targets):
    result = []
    for target in targets:
        result.extend(single_get(target))
    return result
Look into the itertools library in general, for list-and-sequence-manipulating commands. You're looking for a way to "flatten" a list of lists; itertools calls this itertools.chain.

def multiple_get(targets):
    return list(itertools.chain.from_iterable(single_get(target) for target in targets))


However, Python can do it natively as a nested list comprehension:

def multiple_get(targets):
    return [r for target in targets for r in single_get(target)]