Compare source code

Seebs usenet-nospam at seebs.net
Sun Nov 7 14:56:32 EST 2010


On 2010-11-07, Ethan Furman <ethan at stoneleaf.us> wrote:
> Seebs wrote:
>> On 2010-11-05, Ethan Furman <ethan at stoneleaf.us> wrote:
>>> The verifiable benefit for me is ease of use, ease of thought, ease of 
>>> typing... I realize these are not benefits for everyone, but they are 
>>> for some -- and I would venture a guess that the ease of thought benefit 
>>> is one of the primary reasons Python is popular.  I am definitely one of 
>>> those that think indentation based structure is one of Python's best 
>>> features.

>> Could you explain more the "ease of thought" thing?  I haven't yet noticed
>> it, but it might be something to look out for as I get more experienced.

> Most if my programming experience is in FoxPro versions 2 and 6. 
> Control structures start with if, for, do case, do while, with, 
> procedure, and (I think) function.  Control structures end with endif, 
> endfor, endcase, endwhile, endwith, endproc, and (I think) endfunc.

Eww.

> In Python, control structures start with if, for, while, try, def, and 
> class, and each one ends with a dedent.

So they're more consistent.

> This really comes into play when developing -- want to change that if to 
> a while?  Go ahead!  And no need to worry about tracking down the 
> closing endif to change it to endwhile, plus it's less clutter on the 
> screen.

I can see that.  I actually mostly prefer an explicit close.  Of the things
I've used, I'm happiest with braces, because punctuation is good at
being interpreted unconsciously, but I'm okay with "end" as long as it's
the same for everything.  I do like having a things bounded, though; I
find it easier to read:
	if (foo) {
		bar;
	}
	baz;
than
	if foo:
		bar
	baz;

(I'm not quite sure why, but I think it's because the trailing boundary is
part of the thing it bounds, rather than being the start of the thing after
it.)

I would definitely agree, though, that the Python solution is better
than what you describe for FoxPro.  It's also better, IMHO, than sh.

> I also really like the dynamic typing and not having to declare nor 
> pre-initialize variable names, as well as the lack of a true global 
> namespace.

I am torn on declarations -- I am pretty sure I make more mistakes
with clashing variable names when they aren't explicitly declared, but
I do like the much shorter code that results from not having them.

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list