Python generator to yield everything from another generator call

前端 未结 4 706
星月不相逢
星月不相逢 2021-01-07 19:26

I have a Python generator that can call itself to get more elements to yield. It looks like this:

def gen(list):
    # ...
    if list:
        for x in gen         


        
4条回答
  •  情话喂你
    2021-01-07 19:58

    Your code sample is very idiomatic and concise, no need and no real chance for further improvements and especially not when it comes at readability.

提交回复
热议问题