On Mon, 11 Aug 2014 12:56:59 +0100, Robert Kern wrote: > On 2014-08-11 03:04, Steven D'Aprano wrote: >> Rustom Mody wrote: >> >>> Its when we have variables that are assigned in multiple places that >>> we start seeing mathematical abominations like x = x+1 >> >> That's not a mathematical abomination. It's a perfectly reasonable >> mathematical equation, one with no solutions since the line f(x) = x >> and the line f(x) = x+1 are parallel. >> >> But what does this have to do with programming? Programming *is not* >> mathematics, and x = x+1 has a different meaning in programming than in >> mathematics. Perhaps it would help if we wrote it using mathematical >> notation? Using [x] for subscripts: >> >> x[n+1] = x[n] + 1 >> >> we have a perfectly good mathematical recursive definition. All it >> needs is an initial value x[0] and we're good to go. > > Or a different operator for assignment (to distinguish it more clearly > from equality, which it isn't). > > x <- x + 1 x := x + 1
It already is a different operator from equality which is == perhaps it would have been better if the behaviour of these two operators were reversed (= for equality & == for assignment) but i suspect that Idea if even considered was quickly discarded as it would cause major confusion to programmers who work with multiple languages -- Meskimen's Law: There's never time to do it right, but there's always time to do it over. -- https://mail.python.org/mailman/listinfo/python-list