You’re probably looking for Generator Delegation (PEP380)
For simple iterators,
yield from iterable
is essentially just a shortened form offor item in iterable: yield item
def generator(iterable):
for i in iterable:
yield do_something(i)
def generate_all():
yield from generator(get_the_list())
It’s pretty concise and also has a number of other advantages, such as being able to chain arbitrary/different iterables!