Gary <gwengst...@yahoo.com> writes:

> Pythonists
>
> I am trying to understand the difference between
>
> a = b

Retrieves the value referenced by ‘b’, then binds the name ‘a’ to the
value.

> b = a + b

Evaluates the expression ‘a + b’, then binds the name ‘b’ to the result.

>  and
>
> a,b = b, a+ b

Evaluates the expression ‘b, a + b’ – which will be a two-value tuple –
then binds the names ‘a’ and ‘b’ to the two values from that tuple.

Since the right side of the assignment, in each case, is evaluated
before bindling the left side, the resulting values will depend on what
the names are *currently* bound to at the time of evaluation.

-- 
 \        “When in doubt tell the truth. It will confound your enemies |
  `\   and astound your friends.” —Mark Twain, _Following the Equator_ |
_o__)                                                                  |
Ben Finney

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

Reply via email to