Saya punya generator generatordan juga metode kenyamanan untuk itu - generate_all. def generator(some_list): for i in some_list: yield do_something(i) def generate_all(): some_list = get_the_list() return generator(some_list) # <-- Is this supposed to be return or yield? Haruskah...