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

Steven D'Aprano steve at pearwood.info
Sat Feb 7 03:21:30 CET 2009


George Sakkis wrote:
> On Fri, Feb 6, 2009 at 6:59 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> 
>>> In maths,
>>> you only have single-character variable names (sub-/superscripts
>>> notwithstanding), so ab always means a*b.
>> Except in the presence of typos.
> 
> In the presence of typos all bets are off, unless you are aware of any
> typo-proof writing system. Python certainly isn't one since, say,
> "x.y" and "x,y" are pretty similar, both visually and in keyboard
> distance.

You overstate your case: not *all* bets are off, just some of them.

Some typos have greater consequences than others. Some will be 
discovered earlier than others, and the earlier they are discovered, the 
more likely they are to be easily fixed without the need for significant 
debugging effort.

E.g. if I type R**$ instead of R**4, such a typo will be picked up in 
Python immediately. But R**5 instead could be missed for arbitrarily 
large amounts of time.

E.g. if you mean x.y but type x,y instead, then such an error will be 
discovered *very* soon, unless you happen to also have a name 'y'.

But anyway, we're not actually disagreeing. (At least, I don't think we 
are.) We're just discussing how some conventions encourage errors and 
others discourage them, and the circumstances of each.



-- 
Steven




More information about the Python-ideas mailing list