A modest indentation proposal

Erann Gat gat at jpl.nasa.gov
Fri Nov 30 20:30:43 CET 2001

In article <mailman.1007141868.29907.python-list at python.org>, Neil
Schemenauer <nas at python.ca> wrote:

> Erann Gat wrote:
> > Skip:
> > > In Python, if it looks right, it is right.
> > 
> > No, that's not true.  Consider the following two alternative code fragments:
> > 
> > if x:
> >   foo()
> > baz()
> > 
> > if x:
> >   foo()
> >   baz()
> > 
> > They both look right, but they can't both be right.
> How do they both look right?

They are both equally valid programs.  They are both syntactictically and
stylistically correct.  But in a given application at most one of them can
be semantically correct.

> As for moving code around, I agree that it would be nice if the block
> structure of the code was preserved.  I think the solution for this
> problem is not to add extra syntax to the language but to have smarter
> editors.  I believe effbot and the other people at Python Labs are
> working on a "refactoring browser" for Python.  It would be similar to
> what has been done for Smalltalk.

I agree this is basically the right approach.  My point is that there is
not enough information at the moment for a smarter editor to do the Right
Thing with.  The information just isn't there.  I'd just like to add it in
a (semi-)standard way.


More information about the Python-list mailing list