allowing braces around suites

Isaac To iketo2 at netscape.net
Fri Aug 27 10:01:01 EDT 2004


>>>>> "Kjetil" == Kjetil Torgrim Homme <kjetilho at yksi.ifi.uio.no> writes:

    >> and you tab at the last line, Emacs won't try to indent the
    >> t=t2 line further to after the pass line where it is
    >> impossible to execute.
       ^^^^^^^^^^^^^^^^^^^^^

At the second glance this statement is false.  If you have a statement
after "pass" it actually will execute after the pass statement which
does nothing.  So this is purely a convention of Emacs, making use of
a pattern that is never useful in programs anyway.  (If you have such
pass statement and the next statement is in the same suite, you simply
would delete the pass statement.)  The "return" statement also has the
same effect.

    Kjetil> interesting idea, but Python won't discover
    Kjetil> inconsistencies.

It's a Emacs convention, so it is of course the burden of Emacs to
detect inconsistency, i.e., a change of indentation is not indicated
by a "pass", "return", or a statement ending with ":" and perhaps some
comments after it.  I imagine that it would be a very simple regular
expression to write if you really want to do it.

When Python is concerned and Emacs is not, Python only sees there is
indentation, and only indentation, to define the suites.  And it is
also what people will perceive when they stare at the code.  There is
nothing to be inconsistent with it.

Regards,
Isaac.



More information about the Python-list mailing list