Assignment direction (Re: Curious assignment behaviour)
David C. Ullrich
ullrich at math.okstate.edu
Thu Oct 18 13:37:59 EDT 2001
On Thu, 18 Oct 2001 13:34:49 +1300, Greg Ewing
<greg at cosc.canterbury.ac.nz> wrote:
>"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.
Clever of you to omit the context. You'd just said
that "let x = 42" and "let 42 = x" mean the same
thing "mathematically". They don't; the order in
an "assignment" like that matters, as the example
shows.
If you're confused by "let x = y" my advice is
not to try to read a lot of mathematics.
[...]
>--
>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