Inline Immediately Yielded Variable¶
Sourcery refactoring id:
Inline variable that is immediately yielded
def f(a): b = a + 1 yield b def g(a): b = [1, 2, 3] yield from b
def f(a): yield a + 1 def g(a): yield from [1, 2, 3]
Yielding the result directly shortens the code and makes it more readable.