A Summary: Expression-Assignments. (Very Long)

William Tanksley wtanksle at dolphin.openprojects.net
Thu May 13 15:38:22 EDT 1999


On 12 May 1999 14:28:00 -0400, guido at python.org wrote:
>Christian Tismer <tismer at appliedbiometrics.com> writes:

>> It is very consequent, and has nothing to do with a=(b=1) .

>Historical note: Algol-60 (my first programming language) had multiple
>assignment spelled as a:=b:=c, but no assignment expressions.  I never
>thought this was strange.  When I first learned C, I thought it was
>pretty neat how they had defined the binding for assignment
>expressions so that a=b=c still meant what was familiar to me at the
>time.  So all I can do is smile when I hear that people are now coming 
>at Python's use of a=b=c from the opposite direction...

Amusingly, if I were to design an assignment expression without
considering Algol and C's example, I would have to consider whether I
wanted to return the value of the LHS or the value of the RHS.  There are
some times when one wants to get the old value.

But this is academic -- that's not the way anyone _expects_ it to work,
and there are compelling uses for the current version anyhow.  And I
certainly wouldn't want _two_ separate assignment expressions with two
slightly different meanings -- that's as bad as the ":=" suggestion.

>--Guido van Rossum (home page: http://www.python.org/~guido/)

-- 
-William "Billy" Tanksley
"But you shall not escape my iambics."
           -- Gaius Valerius Catullus




More information about the Python-list mailing list