Collective memory (was: Good code patterns in Python)

Charles Shannon Hendrix shannon at news.widomaker.com
Fri Jul 4 23:08:33 EDT 2003


In article <vg88va53uha8e at corp.supernews.com>, Cameron Laird wrote:

> Maybe youngsters don't realize this.
> 
> One monotonous but unremitting argument that Python inspires
> is about the wisdom of its white-space-significance (WSS).
> Modern programmers might not realize how strongly old-timers
> associate WSS with early FORTRAN and COBOL (as we capitalized
> them then), and how unpleasant some of those memories are.
> *That*, I assume, is why WSS discussions become as heated as
> they do.


The problem with Python is that its use of indentation is not the same
as COBOL or FORTRAN.  Apples and Oranges.

Those languages just had an arbitrary format, but it was specific and
easy to catch.

Python uses it for actually determining the logic in your program, which
IMHO is dangerous.

    if <something>
        <work>
        <more work>
        <add numbers>

Is <add numbers> part of the if statement, or did someone with different
tab settings from the author make a mistake and align it accidentally?

One really funny problem was when I guy reformatted his Python code,
around 15K lines of it, and basically unindented *ALL* of the code to
column 1.  It was the only recoverable copy of the code too.

He had to read the entire program line by line to recreate the logic.

The thing that bothers me though is I have found indent-related bugs in
Python code that no one knew about.  The code still ran, but some people
had obviously made some bad assumptions about the logic and indented
it wrong, changing the nature of the program.

I know a lot of people disagree, but I really think whitespace should
not determine flow-control in a program.


-- 
Ah... you gotta love it when your ISP switches to a SPAMMING newsfeed.
Sigh...



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----




More information about the Python-list mailing list