A modest indentation proposal

Steve Lamb grey at despair.dmiyu.org
Fri Nov 30 16:38:58 EST 2001


On Fri, 30 Nov 2001 08:19:02 -0800, Erann Gat <gat at jpl.nasa.gov> wrote:
> Yes, of course we test our mission critical applications.  Please extend
> me the courtesy of not immediately assuming I'm an idiot just because I
> make a proposal that you don't like.  

    I didn't call you an idiot or presume you were an idiot.  I just pointed
out that in light of testing done on mission critical applications your point
is moot since such problems should be found then.

> 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.

    Ok.  Rebuttal.

if x:
  foo();
baz();

if x:
  foo();
  baz();

    Both of these look right, but they can't both be right.


> Well, that's actually what I meant by "backwards compatible."  I know that
> semicolons can be used at the end of statements, but at the moment doing
> so is a no-op.  (All it does is betray you as still thinking in C/Java.) 
> I want to take syntax that is currently legal but useless and make it
> useful.

{grey at antelope:~} cat ga ; python ga
x = 1
if x:
  print "1"
  print "2"
if x:
  print "3";
  print "4";
if x:
  print "5";
print "6";
1
2
3
4
5
6

    It is not backwards compatible if it solves your problem and if it is it
doesn't solve your problem.  As you can see in the second test the first line
does not denote the end of the block because of the semicolon at the end.
This is legal now.  Under your proposal it would become illegal breaking
compatibility.  
    
-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
    To email: Don't despair!   |  -- Lenny Nero, Strange Days
-------------------------------+---------------------------------------------



More information about the Python-list mailing list