A modest indentation proposal

Erann Gat gat at jpl.nasa.gov
Sat Dec 1 02:40:18 EST 2001


In article <slrna0g7em.2pg.grey at teleute.dmiyu.org>,
morpheus at here.not.there wrote:

> On Fri, 30 Nov 2001 14:06:55 -0800, Erann Gat <gat at jpl.nasa.gov> wrote:
> > No, it would not become "illegal" under my proposal.  Please go back and
> > re-read what I wrote, and pay particular attention to the word "optional".
> 
>     What was written:
> 
> ---- SNIP ----
> 
> 2) Parser support.  It would be enough to simply give a warning if
there                         
> is a discrepancy between the block structure defined by indentation
and                          
> that defined by the semicolon-at-end-of-line convention (i.e.
"Warning:                          
> end of block detected without trailing semicolon").  Making this
optional                        
> so that die-hard indentation fans could turn it off would also be fine.     
> 
> ---- SNIP ----
> 
>     What you said was that there would be a warning and that the /warning/
> would be optional.  You did not address the valid concern that...
> 
> if x:
>   foo();
>   bar();
>   baz();
> 
>     ...has to be parsed and under your rules foo(); is the end of the block.
> IE, if we take your proposal as it was presented, that a line that ends with a
> semicolon denotes the end of a block, the above is invalid.  If a line that
> ends with a semicolon does not denote the end of a block, your proposal is
> moot as it doesn't change a thing.

Ah, I think I understand the problem.  What I meant was that a semicolon
would designate the end of the block to the *editor*, which would use that
information together with colons to provide an auto-indent facility. 
Indentation would continue to define the canonical block structure to the
Python parser, but there would be an optional flag that would give a
warning if there was a discrepancy between what the auto-indenter would
produce and what was actually there.

Does that make it any more pallatable?

E.



More information about the Python-list mailing list