allowing braces around suites
tjreedy at udel.edu
Thu Sep 2 22:44:53 CEST 2004
"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. 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.
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.
Terry J. Reedy
More information about the Python-list