JD-Veiga added the comment:
What a shame. I forget that + is also a unary operator. That produces a new
logical line with correct identation though never executed. Sorry for the
inconvenience.⁶
--
___
Python tracker
Steven D'Aprano added the comment:
As Guido says, a full explanation will have to to a user-forum such as
https://discuss.python.org/c/users/7 but consider this example and see if it
gives you insight:
def demo():
x = 1
return (
x - 1
)
print("This is not
Guido van Rossum added the comment:
This is not a bug -- it is how it's supposed to work (for better or for worse).
Please see a use forum to help you understand what's going on here.
--
nosy: +gvanrossum
resolution: -> not a bug
stage: -> resolved
status: open -> closed
New submission from JD-Veiga :
I was trying to return the concatenation of several lists from a function but,
inadvertently, forgot to surround the multi-line concatenation expression with
parentheses.
As a result, the function returns just the first operand and does not perform
the