Toomai
(Toomai)
July 2, 2006, 7:05pm
1
I wasn’t too sure where to stick this, but I thought this would be the best place.
Too many times now, I’ve made a mistake like this:
#this is what I wanted
x = y
#this is what I typed
x == y
Why does this not bring up an error in the console? I mean, it’s basically a single line with a 0 or a 1 on it. Shouldn’t that be a syntax error?
Friday13
(Friday13)
July 2, 2006, 9:01pm
2
Well, if x and y are defined already, you should get no errors from that expression. If x hasn’t been defined and you still don’t get an error message, well…I don’t know, really
Aligorith
(Aligorith)
July 2, 2006, 11:29pm
3
That’s very strange. I have a feeling though, that “this might in fact be intended behaviour”.
With
x = y
you are assigning the value of y to x
With
x == y
you are testing whether x equals y?
But when it appears on a line of its own, the outcome of this test is ignored, and no action is taken.
Both Python 2.3 and Python 2.4 do this.
Aligorith