anything like C++ references?
intentionally at blank.co.uk
Tue Jul 15 01:35:46 CEST 2003
On Mon, 14 Jul 2003 19:17:59 -0400, Roy Smith <roy at panix.com> wrote:
>Stephen Horne <intentionally at blank.co.uk> wrote:
>> Ah - but this is also Pythons fault. It has arbitrarily redefined the
>> meaning of a mathematics operator - presumably simply because C, C++,
>> Java, Basic and others have done this in the past.
>> Personally, though, I'd go with Pascal on this one.
>Most languages have two "equals" operators, one means assignment, the
>other means test for equality. Depending on the language, these are
>spelled "=" and "==" or ":=" and "=" (or a few other variations).
That's why I referred to Pascal.
>The wierd thing is that I don't think either one really matches what a
>mathematician means when he writes "=". In math, "=" is neither an
>assignment or a test: it's an assertion.
99 out of 100 times, true. But not always - especially in discrete
For example, if I write...
[forall] x . f(x) = y
It's hard to interpret that '=' as an assertion. Similar applies to a
range of maths operators.
Basically, the way I rationalise it is that when I see what looks like
a boolean expression standing on its own, I take it as an assertion
that that expression evaluates to true. I'm not saying that has any
mathematical validity, but it does seem to cover all cases.
So if I see...
x = 1
I take it as an assertion that the boolean test 'x = 1' evaluates to
true, and from that I can infer the value bound to x (or, in other
cases, infer some properties of that value).
Or rather I don't - but that's the rationalisation for what I do do.
More information about the Python-list