Assignment direction (Re: Curious assignment behaviour)

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Oct 17 20:34:49 EDT 2001


"David C. Ullrich" wrote:
> 
> What if you already have x = 42 and y = 24, and you
> say "let x = y" ? Does that set x to 24 (yes) or
> does it set y to 42?

I'd say it confuses the reader, without further
explanation.

By the way, when I was very young, before I'd had
much contact with real computers or HLLs, I designed
a programming language in which assigment was written
<expr> = <variable>, e.g. A + B = C. It seemed logical 
to me -- you do the arithmetic first and then store 
the result!

I was quite surprised when I found out later that
most languages do it the other way around.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list