[Python-ideas] PEP 3150 (statement local namespaces) updated based on April discussion
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Jun 14 02:47:10 CEST 2011
Terry Reedy wrote:
> Part of my point is that the above is not *code* (and hence not an
> argument for formatting code that way).
A couple of things about that:
1) Mathematicians often write things informally that, in a program,
would need to be spelled out formally in code. They get away with
it because they're writing for humans, not computers.
2) Very often they *do* write out the subsequently-defined terms
formally. I came across an example just the other day. From
"Elementary Numerical Analysis, an Algorithmic Approach" by
Samuel D. Conte and Carl de Boor, 3rd edition, page 364:
<quote>
Runge-Kutta method of order 4:
y[n+1] = y[n] + (1/6) * (k1 + 2*k2 + 2*k3 + k4)
where
k1 = h*f(x[n], y[n])
k2 = h*f(x[n + h/2], y[n] + k1 / 2)
k3 = h*f(x[n + h/2], y[n] + k2 / 2)
k4 = h*f(x[n], y[n] + k3)
</quote>
--
Greg
More information about the Python-ideas
mailing list