First day beginner to python, add to counter after nested loop

Grant Edwards invalid at invalid.invalid
Wed Oct 30 11:50:43 EDT 2013


On 2013-10-30, Antoon Pardon <antoon.pardon at rece.vub.ac.be> wrote:
> Op 30-10-13 08:07, Tim Roberts schreef:
>> jonas.thornvall at gmail.com wrote:
>>>
>>> Why did Python not implement end... The end is really not necessary for
>>> the programming language it can be excluded, but it is a courtesy to
>>> the programmer and could easily be transformed to indents automaticly,
>>> that is removed before the compiliation/interpretation of code.  
>> 
>> You only say that because your brain has been poisoned by languages that
>> require some kind of "end".  It's not necessary, and it's extra typing. 99%
>> of programmers do the indentation anyway, to make the program easy to read,
>> so why not just make it part of the syntax?  That way, you don't
>> accidentally have the indentation not match the syntax.
>
> Because it is a pain in the ass. Now suddenly my program doesn't work
> because I somehow inserted a tab instead of spaces.

Then don't do that.

I'm only half-kidding.  Inserting incorrect tokens into program source
breaks programs in all languages.  The tricky bit is that in many
editors spaces and tabs look the same.  You can pick an editor that
provides a visual difference, or you can pick an editor that always
does the right thing, or you can stick with it until your fingers
learn to do the right thing.

> The end would also gives extra protection against faulty
> manipulations. I have at one time accidently copied a function partly
> further below. Because python doesn't need an end, the compilor was
> unable to detect this was only part of a function which caused a bug
> which was harder to find.
>
> Python made it's choice and I can live with that, but telling people
> who prefer it had made an other choice that their brain is poisoned,
> only shows you are unable to see the disadvantages.

Those of us who've been using Python for more than a few days think it
is you who are unable to see the advantages. ;)

Whether allowing indentation via either tabs or spaces was a
fundamental design flaw has long been debated.  Personally, I think
tabs should be outlawed in all source code...

-- 
Grant Edwards               grant.b.edwards        Yow! Uh-oh!!  I'm having
                                  at               TOO MUCH FUN!!
                              gmail.com            



More information about the Python-list mailing list