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

Leonardo Santagada santagada at gmail.com
Sat Feb 7 15:19:50 CET 2009


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...

And for a testable program is much more easily verifiable than a  
mathematical proof on paper (specially because our brain is used to  
fix little problems in reality to match what we think is right).

Still I think that ab to mean a*b in python is silly, even if python  
was only the scripting language of Sage.

--
Leonardo Santagada
santagada at gmail.com






More information about the Python-ideas mailing list