Linters like ruff would convert the following code
def foo():
bar = 1
return bar
to
def foo():
return 1
However, I believe that assigning the return value to a variable also has benefits:
- one can easily see the return value in the debugger
- we give the return value a name (which sometimes helps to understand code).
Am I mistaken in my opinion?
1