I have a newbie question for python gurus.
I have function A that hold a lot of repeated yield-actions like so:
yield a
yield b
yield c
so it looks like:
def funA():
…
yield a
yield b
yield c
…
yield a
yield b
yield c
…
yield a
yield b
yield c
Is there any way to put all repeated yields in function and do something like that?:
def funA():
…
yield funB()
…
yield funB()
…
yield funB()
Update
yield a
yield b
yield c
It's just an example but in a real application its more complex sequence of yields that repeat more then once in main generator (so it's not question about organizing yields) but about sub-generators. So I'd like to avoid code duplication.