[Python-ideas] Making stars optional? (was: Making colons optional?)

Georg Brandl g.brandl at gmx.net
Fri Feb 6 19:21:13 CET 2009


Steven D'Aprano schrieb:

> Mathematicians get away with this sort of ambiguity because they are 
> writing for other mathematicians, not for a computer. Because 
> mathematical proofs rely on a sequence of equations, not just a single 
> statement, the ambiguity can be resolved:
> 
> y = a(b+c) - ac  # does this mean a+() or a*() or something else?
> y = ab + ac - ac  # ah, it must have been a*()
> y = ab

No context is needed to know what a(b+c) means.  In maths,
you only have single-character variable names (sub-/superscripts
notwithstanding), so ab always means a*b.  Together with some other
conventions, like that nobody writes a3 instead of 3a, everything is
unambiguous.

Though there *are* programmers who wouldn't notice if Python 3.0 switched
to one-character-only variable names, they are probably a minority and
hopefully dying out :)

Georg


-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Python-ideas mailing list