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

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to