After looking at these two questions,
I had this question:
How does a = b = c = 42
propagate 42
to the left without returning the value at each step?
Because of a special exception in the syntax, carved out for that exact use case. See the BNF:
assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)
Note the (target_list "=")+
.
Chained assignment in this manner does not require assignment to return a value. It is a special form of the assignment statement which binds the object to multiple names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With