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

Lie Ryan lie.1296 at gmail.com
Tue Feb 10 08:19:58 CET 2009

On Sat, 07 Feb 2009 12:19:50 -0200, Leonardo Santagada wrote:

> On Feb 7, 2009, at 12:21 AM, Steven D'Aprano wrote:
>> 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.
> This doesn't really makes much sense to me... if you don't use tests to
> verify your program both R**5 or R**A are just the same error if for
> example this code path is a rare case, it will only be discovered when
> something goes wrong with the program...

If that piece of code is in a rarely walked path, then it is even worse 
since the bug could easily creep into production release without anyone 

It happens that there are three classifications of errors in programming:
Syntax Error - easily found, impossible to creep into production release 
since compiler/interpreter would complaint loudly
Runtime Error - found when the code path is walked, comprehensive testing 
would reveal such errors
Logic Error - hard to find, hard to debug

It happens that most typos would become SyntaxError and LogicError. 
Implicit multiplication currently becomes a SyntaxError, since python 
recognizes no implicit multiplication, OTOH if we introduce implicit 
multiplication, it'll invariably becomes Logic Error or Runtime Error.

More information about the Python-ideas mailing list