allowing braces around suites

Antoon Pardon apardon at forel.vub.ac.be
Fri Sep 3 03:24:30 EDT 2004


Op 2004-09-02, Terry Reedy schreef <tjreedy at udel.edu>:
>
> "Antoon Pardon" <apardon at forel.vub.ac.be> wrote
>> My experience is that in such a situation, especially
>> if the local functions grows of you have more
>> local functions it can become hard to see where the body
>> of the global function begins. Just looking at the
>> deindentation is not enough because that could be the
>> result of a control suite that ended. Using an endmarker
>> like #def can make finding the beginning of the main
>> function a lot easier and so make the code more readable
>> and maintainable.
>
> This is what I might do, except maybe as #enddef
>
> and in another message
>> Python seems to do its best so that there is only one way to
>> do things. Python seems also to do its best force people
>> to write readable easily maintainable code. Since end markers
>> can be a tool in this and the only way to have only one way
>> to do this is if the language includes it, So why doesn't
>> python has them.
>
> Python does -- a dedent.

That is IMO not an endmarker, or at least not an explicit one.
If it was explicit you couldn't be confused between thinking
a certain code was dedented three or four times.

> For humans, this can be supplemented -- as you 
> suggested above -- with an ending comment, with specific format chosen by 
> the programmer.  The specific form is irrelevant to the interpreter and any 
> sensible form should be generally readable.

But I thought python wanted to provide as much as possible only
one correct way to do things.

> I agree with others that nesting can be reduced by extracting and naming 
> appropriate chunks of code, I agree with you that as an independent 
> programmer you have no obligation to do so.  But I do not see your choice 
> as a reason to add a third endmarker.  Not do I see a need to 'standardize' 
> comments used as such.

It is not about my choice. I'll get by whatever the outcome. Just as I
in general write proper indented code even in languages that don't
enforce it. I just find it odd that a language that tries to enforce
readablity does't include end markers, who IMO increase readability.

-- 
Antoon Pardon



More information about the Python-list mailing list