Hi,

>     a, b = b, a +b

> a = b = 1
> b = a + b = 1 + 1 = 2

Your issue is that you interpret the assignment wrong. You seem to think
that it assigns b to a and THEN a+b to b, which is not the case. The
right side of the assignment creates a tuple, and the left side unpacks
it. It is the same as:

t = (b, a+b)
a = t[0]
b = t[1]

You see that a has not been assigned yet when the second part is calculated.

Cheers,
Nik

-- 
* mirabilos is handling my post-1990 smartphone *
<mirabilos> Aaah, it vibrates! Wherefore art thou, demonic device??

PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17  FD26 B79A 3C16 A0C4 F296

Attachment: signature.asc
Description: Digital signature

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

Reply via email to