Python: How does multiple assignments in a single line work?
问题 I know that assignment is a statement in Python, i.e., it doesn't evaluate to a value unlike an expression. How does the following line of code work in Python, then? Please explain what happens internally in the Python interpreter (lexing, parsing, formation of abstract syntax tree). # this works spam = eggs = 'ham' # this doesn't work. Throws SyntaxError spam = (eggs = 'ham') 回答1: why the first line above works while the second doesn't? It's not about operator precedence. It's a designated