allowing braces around suites

Antoon Pardon apardon at forel.vub.ac.be
Tue Sep 7 10:27:25 CEST 2004


Op 2004-09-07, Terry Reedy schreef <tjreedy at udel.edu>:
>
> "Antoon Pardon" <apardon at forel.vub.ac.be> wrote in message 
> news:slrncjo20a.7or.apardon at rcpc42.vub.ac.be...
>> No Python doesn't support end markers. That you can use an idiom of
>> comments to help the humean reader in distinghuishing the end of
>> a block is not the same as the language supporting end markes.
>
> What do mean by support?

That it is part of the language.

If allowing people to use some idiom of comments as end markers,
would imply support for end markers in the language then I would
have to conclude that C and other languages support indentation
because the user is certainly allowed to indent his code correctly.
when he programs in those languages.

> Python allows.  Redundant markers would be severe 
> problem if inconsistent.

Well I have the following proposition. I don't expect this
to be implemented in the current python implementation,
maybe something for python 3000. But just think about it.

For each controlstruture have a corresponding endmarker:
enif, enddef, ...

Now allow people to put the correspondig endmarker at
the end of a suite indented the same as the control
structure.

So you could have something like the following


  def foo():

    for ... :
      if ... :
        for ...:
          lots
          of
          code
  enddef

  rest
  of
  code.


The disadvantage is of course the introduction of
new keywords, but I doubt many people will use
these as identifiers.

The advantages are that it wouldn't break any code
(except for the introduction of the keywords), if
dedention is clear enough you are not forced to
use an end marker. Where an end marker is used, the
language can check somewhat that it is used correctly.

-- 
Antoon Pardon



More information about the Python-list mailing list