Multiple assignment and the expression on the right side
Robert Kern
robert.kern at gmail.com
Tue Feb 21 00:42:25 EST 2006
Suresh Jeevanandam wrote:
> Dear all,
> I read in "Python in a Nutshell" that when we have multiple assignments
> made on a single line, it is equivalent to have those many simple
> assignments and that the right side is evaluated once for each
> assignment. [The wordings are mine. I am not sure if this is what he
> intended].
No, it isn't. He says, "Each time the statement executes, the right-hand side
expression is evaluated once." "[T]he statement" refers to the multiple
assignment as a whole.
--
Robert Kern
robert.kern at gmail.com
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list