do people really complain about significant whitespace?

Gerhard Fiedler gelists at gmail.com
Thu Aug 10 10:55:14 EDT 2006


On 2006-08-10 07:40:01, Stephen Kellett wrote:

> To answer your first question: In C++/Ruby/Pascal you'd have something
> like this
> 
> function()
> {
>         loop1()
>         {
> [...]
>         }
> }

> I really dislike that the end of loop2  is implicit rather than
> explicit. 

Since in the above languages indentation is optional but you still use it
(and even may use a program that provides the correct indentation if the
coder didn't do it), what prevents you from adding optional end-markers in
Python? They are not required, but they are not forbidden either, very
similar to the indenting in the above languages. Something like this:

function()
        loop1()
                blah
                blah

                loop2()
                        blah

                        loop3()
                                blah
                        #end loop3()

                        blah3
                #end loop2()
        #end loop1()

        otherloop()
                blah
        #end otherloop()
#end function()

Of course, few people will write like this, but it probably is easier to
write a Python code formatter that adds them than it is to write a C code
formatter that adds proper indentation and provides your preferred
placement of braces.

Gerhard




More information about the Python-list mailing list