If the choice is between these two approaches, I would choose the first. return pretty clear that execution ends at this point. For this reason, I find if x { return y } else { ... } anti-pattern (not only in Python - I see this in C / C ++ code, and this is also annoying).
If you return, the else block is completely unnecessary and causes a meaningless indentation of the code block, which can be quite large. The more nested structures you have, the more difficult it is to maintain the right context in your head when reading code. For this reason, I prefer less nesting when it does not confuse logic, in which case I do not think it would be.
source share