def list_function(x):
return x[1] += 3
I want to do this, but apparently I can\'t. I understand I can do this
x[1] += 3
return x
>
From documentation -
return_stmt ::= "return" [expression_list]
The return statement can only be followed by expressions. expression_list is -
expression_list ::= expression ( "," expression )* [","]
But x[1] += 1
is an augmented assignment statement , and as such you cannot have that after return
.