Sometimes I see code like this:
def function():
...
some_value = ...
return some_value
What the point in creating this intermediate variable? Why do we need it?
This is done for consistency and more readable source code.
Can I start working on this ? To clarify the fix would be to remove all these intermediate variables in all function returns?
@loucadufault you are welcome!
The fix would be to return a direct value.
Wrong:
def some_function():
some_value = 1
return some_value
Correct:
def some_function():
return 1
Can I work on this issue?
@Chinmaygoyal I am on finish line to complete this issue
@Chinmaygoyal feel free to take #545
Hello @sobolevn
The immediate value is good in the next case:
def function(a):
result = None
if a:
... # some actions
result = 123
return result
As for me, it is also understandable from the naming of value what we will return after calling of function.
@DmytroLitvinov yes, this code is valid.
What do you mean by:
As for me, it is also understandable from the naming of value what we will return after calling of function.
Most helpful comment
@Chinmaygoyal I am on finish line to complete this issue