osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Every Release Can Be a Mini "Python 4000", Within Reason (was (name := expression) doesn't fit the narrative of PEP 20)


On 4/30/2018 4:00 PM, Jeff Allen wrote:

> They were not "statements", but "formulas" while '=' was assignment (sec 
> 8) *and* comparison (sec 10B). So conversely to our worry, they actually 
> wanted users to think of assignment initially as a mathematical formula 
> (page 2) in order to exploit the similarity to a familiar concept, 
> albeit a=a+i makes no sense from this perspective.

When explaining iterative algorithms, such as Newton's method, 
mathematicians write things like a' = a+1 or a(sub i+1 or sub new) = 
f(a(sub i or sub old)) .  For computer, we drop the super/subscript.  Or 
one can write more circuitously,
anew = update(aold)
aold = anew
The abbreviations should be explained when teaching loops.

For proving that the body of a loop maintains a loop constant, one may 
reinstate the super- or sub-script.

-- 
Terry Jan Reedy