Grouping code by indentation - feature or ******?

Roy Smith roy at panix.com
Tue Mar 29 08:35:47 EST 2005


Antoon Pardon <apardon at forel.vub.ac.be> wrote:
> 1) The stuff doesn't has to be spread over multiple pages. One
>    can have 2 functions, each about three quarter of a page.
>    The second function will then cross a page boundary.

The advice "don't write a function longer than a page" is as good advice 
today as it was 30 years ago, but the definition of "a page" has changed.  
In the old days, "a page" pretty much meant 66 lines, because that's what 
fit on a standard sheet of line printer paper (minus a few lines for 
headers and footers).

These days, "a page" pretty much means "a window", which are scrollable so 
your function always starts at the top of one.  Of course, there is no 
standard for how long a window is, but...

> 2) How long is a page? I have worked in differend kind of
>    environments where the number of lines per page could
>    differ from 35 to 70.

I would say 35 to 70 lines seems like a reasonable limit for how long a 
function should be :-)  The system I'm working with now is fill with 500 
line functions and 700 line functions.  Believe me, 70 lines would be a 
blessing compared to that.

The bottom line is not a rigid line count.  The goal is to be able to 
understand what the function is doing in one gulp.



More information about the Python-list mailing list