Lift Return into If
Sourcery refactoring id:
def f(): if condition: val = 42 else: val = 0 return val
def f(): if condition: return 42 else: return 0
This is a quick way to streamline code slightly. Where a value is set on each branch of an if and then immediately returned, instead return it directly from each branch.
This has removed an unnecessary intermediate variable which we had to mentally track.