Compare source code

Antoon Pardon Antoon.Pardon at rece.vub.ac.be
Thu Nov 4 13:02:09 CET 2010


On Wed, Nov 03, 2010 at 11:37:03AM +0000, Steven D'Aprano wrote:
> On Wed, 03 Nov 2010 12:01:06 +1300, Lawrence D'Oliveiro wrote:
> 
> > In message <ianem3$cuq$1 at reader1.panix.com>, Grant Edwards wrote:
> 
> >> Other languages have similar problems if you remove salient bits of
> >> syntax before comparing two source files files.
> > 
> > But other languages don???t make those ???salient bits of syntax??? invisible.
> > I.e. they are actually ???salient???.
> 
> (1) Indentation is visible. Compare:
> 
> 
>     This line has leading visible whitespace.
> 
> This line has leading invisible characters.
> 
> See the difference?

Unless, your code is split over different pages, as when it is printed in a book.
You also need to see the next piece of code to notice the dedention.

e.g. I have the following code at the bottom of my editor.

  for i := 0 to 9 do
    some(code);
    more(code);
  end;

I can by just looking at this code notice that I'm looking at the whole for block.


But when I have similar python code at the bottom of the page.

  for i in xrange(10):
    some(code)
    more(code)

Then I can't make out whether I'm looking at the whole for suite or not.

Indentation may be visible, but it is not context-free visible, It only
becomes visible by looking by introducing context. So because it is only
visible by looking at the context I would say the end of a block i made
implicitly and not explicitly

-- 
Antoon Pardon



More information about the Python-list mailing list