Curious assignment behaviour

Nomad nomad*** at ***freemail.absa.co.za
Fri Oct 19 05:59:43 EDT 2001


On Thu, 18 Oct 2001 17:37:53 GMT, "Rainer Deyke"
<root at rainerdeyke.com> wrote:

>"David C. Ullrich" <ullrich at math.okstate.edu> wrote in message
>news:3bcdbb39.1987133892 at news...
>> 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?
>
>It means "consider the case 42 = 24".

In a mathmatical sense or a programming sense?  I haven't read all of
this thread, and I'm not the worlds greatest at maths, but from my
view point the discussion seemed to start about programming syntax.

>From the programming side of things "Let x = 42" (or however you want
to write it) says "give the _variable_ x the value 42" (or consider
the case where the _variable_ x = 42).

The important word here is 'variable' because in programming, x is
variable (as in, its value can change).  42 will always be 42, it is
an explicit constant, whereas x isn't, x is only a placeholder for the
value you give it.

There for, using the above example, of let x = y (where the _variable_
y has been set to 24), the value of x will be changed to equal the
current value of y, which is 24.

I'm probably over my head (and more than likely rambling as well), but
in "let x = y" doesn't the 'let' denote that the value of 'x' will be
changed?

Confusing-himself-ly y'rs
-- 
Nomad

Wondering of the vast emptyness of the 'net
in search of something cool.



More information about the Python-list mailing list