Compare source code

Grant Edwards invalid at invalid.invalid
Tue Nov 2 10:20:21 EDT 2010


On 2010-11-02, Seebs <usenet-nospam at seebs.net> wrote:
> On 2010-11-01, Grant Edwards <invalid at invalid.invalid> wrote:
>> On 2010-11-01, Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> wrote:

>>> I'm getting less and less keen on that particular feature of
>>> Python...
>
>> Why?
>
>> Other languages have similar problems if you remove salient bits of
>> syntax before comparing two source files files.
>
> Sure.
>
>> For exmaple, if you remove all of the curly-braces from two C source
>> files before comparing them, you don't get useful results.
>
> Right.
>
> But there's no *reason* to do that, while there are many common daily
> events which result in whitespace changes.  e.g., any email sent to
> my work account is being magically transformed into HTML (no one
> knows why) on the server, so I can't get correct indentation except
> in attachments.

And you think compatibility with your broken e-mail server is a good
reason to change the syntax of a programming language?

> Many editors helpfully convert spaces to tabs by default some or all
> of the time.  And so on.

Such editors are broken.

> The more I use it, the more I think it was an interesting experiment
> which has worked out about as well as scanf.

I think it's brilliant (indentation that actually means something, not
scanf).

> The "problem" it fixes is something that's hardly ever been a problem
> for me in C or related languages -- and which could be completely
> eliminated by automated indenters, which were actually conceptually
> possible.

They're only possible if you put redundant block markers in the
source.

> I've lost more time to indentation issues in Python in a month than
> I've lost to mismatches between indentation and flow in C in twenty
> years.

Then you're doing something terribly wrong.  I find indentation-based
structure to be completely effortless.  Are you using an editor that
doesn't have a Python mode?

> In theory, it sounds like it would help to eliminate the ambiguity.
> In practice, eliminating the question of whether code was intended to
> follow explicit flow rather than indentation just means that when
> there's a mistake you don't even get a warning that someone was
> confused.
>
> At least in C, if I see:
> 	if (foo)
> 		a;
> 	else
> 		b;
> 		c;
>
> I *know* that something is wrong.

I suppose you can add comments to Python if you some syntactically
null "redudundacy" to indicate the intended structure.  Personally,

-- 
Grant Edwards               grant.b.edwards        Yow! I'm having a
                                  at               quadrophonic sensation
                              gmail.com            of two winos alone in a
                                                   steel mill!



More information about the Python-list mailing list