On Fri, Mar 21, 2014 at 3:25 PM, Gary Engstrom <gwengst...@yahoo.com> wrote:
> I am trying to understand function fibc code line a,b = b, a + b and would
> like to see it written line by line
> without combining multiply assignment. If possible. I sort of follow the
> right to left evaluation of the other code.

Sure.  a,b = b, a+b is equivalent to:

new_a = b
new_b = a + b
a = new_a
b = new_b
del new_a
del new_b

That is, we first evaluate everything on the right hand side of the
equals sign, then assign those values to a and b.  Then we get rid of
the temporary variables, since the original statement didn't leave any
temporary variable floating around.

-- 
Jerry
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to