Create a generator that yields values from any number of inner generators
问题 I have a generator function generate which yields 5 random numbers one at a time. I need to be able to generate the numbers in two ways: Single generation, which means a single output of generate function Multiple generation, which means multiple execution of generate and yielding all the results together as a single (merged) flow For that I wrote another function get_resource , which calls generate either once or using itertools.chain to run the generators one after another, but